dhtml

Determine which element submitted a form from within onsubmit

Is there a way to determine which element submitted a form from within an onsubmit handler? Trying to write a generic handler that knows which element was clicked. For example, given this form: <form onsubmit="onSubmitHandler"> <input type="submit" name="submit1" /> <input type="submit" name="submit2" /> </form> How can I dete...

Scrolling a page using location.hash in Safari

I have a forum page that displays a tree view of messages below the currently selected message. When you click on a message in the tree the new message body is loaded into a div near the top of the page using AJAX and then the following code is run: window.location.hash = "page_top"; Of course "page_top" is an anchor element near the ...

how to overcome IE bug when dynamically attaching div to body from script

UPDATE: the HTML was not well formed. This was causing the script to appear in inner div. Please ignore the question. IE ver<8 has a known bug (Internet explorer cannot display the page. Operation aborted) If a script tries to append something to upper level block: The bug is described here: Update: I rephrased the question and simp...

Is it possible / recommendable sending HTML emails containing Javascript?

This is mostly a rhetorical question, as far as I've checked the answer is 'don't even bother', but I wanted to be really sure. We have an email app, where you can send email to lists of subscribers. This is not spam: it's used, for example, by an university to send communications to its students, by a museum to send emails to subscribe...

.getElementById IE

Hi. I've got a JavaScript running 2 ".getElementById('').style" changes. Both work perfectly in FF, but the first one doesn't work in IE7. Appreciate all help :) First SourceCode: function ingen() { document.getElementById('merInfo1').style.display='none'; document.getElementById('merInfo2').style.display='none'; document....

Best way to display Javascript/Div based hover windows?

I'm talking about the Ibox sort. I.e, user clicks a link and a small javascript based div hovers up containing a small form or such. I will want to give users a <script> tag which they would place in their website. Then, they would put the required javascript function in their <a href> tag which they want to use for displaying the form....

How to load up CSS files using Javascript?

Is it possible to import css stylesheets into a html page using Javascript? If so, how can it be done? P.S the javascript will be hosted on my site, but I want users to be able to put in the <head> tag of their website, and it should be able to import a css file hosted on my server into the current web page. (both the css file and the j...

Live username lookup with AJAX/Jquery

I want to have a javascript function such as this: function isUsernameAvailable(username) { //Code to do an AJAX request and return true/false if // the username given is available or not } How can this be accomplished using Jquery or Xajax? ...

What do you call DHTML these days?

So lately I've been catching a lot of crap from a junior developer whenever I use the term "dHTML". I know the term is dated, but it's descriptive of what the task is: changing rendered markup on the client. I cringe whenever i see the term Ajax applied to client side animation or form validation where no asynchronous request is being ma...

How to redirect parent window from an <i frame> using Javascript?

What the title says. How can it be done? I want them to click a hyperlink which, using javascript or any other methods, would redirect the parent window to a new url. ...

jQuery UI performance issues with a table in IE

I'm having problems getting UI code to perform at all well in IE. I have a table - a matrix of values. Each cell can be empty or hold a list of items. I want users to be able to drag items between cells. So my HTML looks something like this: <table> <tr><td></td><th scope="col">col 1</th><th scope="col">col 2</th></tr> <tr><t...

Free-Form Date Picker - like RTM

I'm looking for a way to have a textbox that allows users to type in a date in any format and turns around and formats that date in a 'mm/dd/yyyy' format. So the user could type in "Today" and it would turn the date as 02/24/2009 or they could type in Wednesday Feb 24 and formatting would automatically pick up. Remember the Milk does t...

Jquery and appending large amounts of html

I have come to find that using jquery to create html client-side can be a huge performance booster if done properly. I use ajax returning json to retrieve dynamic content and then I build the relevant html and insert it using jquery. The first time I messed with this technique I found that the string concatenator in IE's javascript per...

Getting all selected checkboxes in an array

So I have these checkboxes: <input type="checkbox" name="type" value="4" /> <input type="checkbox" name="type" value="3" /> <input type="checkbox" name="type" value="1" /> <input type="checkbox" name="type" value="5" /> And so on. There are about 6 of them and are hand-coded (i.e not fetched from a db) so they are likely to remain the...

Differential AJAX updates for HTML table?

I have a game on Google App Engine that's based on a 25x20 HTML table (the game board). Every 3 seconds the user can "move," which sends an AJAX request to the server, at which time the server rerenders the entire HTML table and sends it to the user. This was easy to write, but it wastes a lot of bandwidth. Are there any libraries, clie...

IE is not submitting; dynamically added form elements; is this an IE bug?

I wrote some Javascript to allow editing a list of items within an HTML form, including adding and removing items. Got it working in Firefox. When trying it in Internet Explorer, I found that any added items were not being submitted with the form. Long story short... lots of simplification, debugging, figured out what line is triggering...

decodeURIComponent vs unescape, what is wrong with unescape ?

In answering another question I became aware that my Javascript/DOM knowledge had become a bit out of date in that I am still using escape/unescape to encode the contents of URL components whereas it appears I should now be using encodeURIComponent/decodeURIComponent instead. What I want to know is what is wrong with escape/unescape ? T...

Recommendations for simple AJAX?

I want to get smarter in AJAX, but not sure which way to go. I have done some DHTML programming back in the day - like 8 years ago!, before it was called AJAX. I used emacs and hand-coded all the javascript, debugged via "Alert". At this point I think there are frameworks out there that make things nicer and easier, but which ones? ...

Are there any good splash ad scripts out there?

I am using a splash page for a random full page ad. It was downloaded from dynamic drive web site, but it wont work. Can any body show me any other scripts for splash page ad display. ...

Dynamically hide form on submit?

Hello, I am not a big web programmer, and have a friend who wants me to help him with something. He wants to be able to have a form that once it is submitted changes to say something like "Thanks for submitting" and have the form info disappear. He wants it to be easy for anyone to use, so he can give it to various people to use on th...