[Javascript] Changing an Objects ID and Name
tedd
tedd at sperling.com
Wed Sep 6 09:32:20 CDT 2006
At 8:56 AM -0400 9/6/06, Terry Riegel wrote:
>I would like to swap out an image in an application I am writing.
>Basically I want to swap two image tags, the trick is I want to swap
>their ID and NAME tags also.
>
>For example, I have the following HTML...
> ...
><img src="image1.jpg" width="100" height="200" name="abc" id="abc">
><img src="image2.jpg" width="120" height="180" name="def" id="def">
> ...
>that I would like to use javacscript to make into...
> ...
><img src="image2.jpg" width="120" height="180" name="def" id="def">
><img src="image1.jpg" width="100" height="200" name="abc" id="abc">
> ...
>
>The important thing Is I would like to swap all of the attributes
>out. i.e. width,height,id,name,src
Terry:
I don't know about objects, but you can do what you described above
several ways:
1. With ajax you can change the html between divs.
2. With css you can absolutely position both and then swap with a
style switcher.
3. With css you can use the visibility attribute showing both
combinations and then change visibility/hidden with a style switcher.
4. Or, you can do it like this via js:
http://xn--ovg.com/a1.php
hth's
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
More information about the Javascript
mailing list