943,859 Members | Top Members by Rank

Ad:
Aug 13th, 2007
0

picture change

Expand Post »
does any 1 know how to give a picture a tag or name and then in javascript or vbscript change it ?
Similar Threads
Reputation Points: 6
Solved Threads: 2
Junior Poster
scrypt3r is offline Offline
114 posts
since Aug 2007
Aug 13th, 2007
0

Re: picture change

You can give an html element an ID.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <img src="something.jpg" id="yourId">

Then look the object up using the ID.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. var domElement = document.getElementById("yourId")

Now you have a reference to the dom element and you can interact with its properties...

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. domElement.src = "somethingnew.jpg";

That is pretty much all you need to do...
Reputation Points: 20
Solved Threads: 5
Junior Poster
alpha_foobar is offline Offline
182 posts
since May 2005
Aug 14th, 2007
0

Re: picture change

thnx
Reputation Points: 6
Solved Threads: 2
Junior Poster
scrypt3r is offline Offline
114 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Urgent : Need Help !!!
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: random slideshow with random timer...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC