[Javascript] Changing an Objects ID and Name

Brian L. Matthews blmatthews at gmail.com
Wed Sep 6 11:05:07 CDT 2006


>1. With ajax you can change the html between divs.

No. Ajax is the client communicating with a server, usually using 
XMLHttpRequest. While lots of applications manipulate the DOM in the 
client based upon the result of the request, the two are completely 
independent. A page can make XMLHttpRequests and then not change the 
page in any way, and JavaScript (or other client side scripting 
languages) can modify the page using DOM methods without talking to a 
server at all.

>4. Or, you can do it like this via js:
>
>http://xn--ovg.com/a1.php

That page manipulates the DOM using innerHTML (at least the show 
part, the don't show part just reloads the page from the server.) It 
would also be better done by manipulating the visibility or display 
style attributes.

>I need to change the images in the original HTML.

Does this mean if the user reloads the page they should see the 
images where they moved them to? Then you'll need to have the page 
tell the server what images have swapped, as the script in the client 
can't make permanent changes to the page. For actually swapping the 
images on the client side, using DOM methods like someone posted 
earlier to swap the img nodes is probably the way to go.

Brian



More information about the Javascript mailing list