954,228 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

picture change

does any 1 know how to give a picture a tag or name and then in javascript or vbscript change it ?

scrypt3r
Junior Poster
114 posts since Aug 2007
Reputation Points: 6
Solved Threads: 2
 

You can give an html element an ID.

<img src="something.jpg" id="yourId">


Then look the object up using the ID.

var domElement = document.getElementById("yourId")


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

domElement.src = "somethingnew.jpg";


That is pretty much all you need to do...

alpha_foobar
Junior Poster
182 posts since May 2005
Reputation Points: 20
Solved Threads: 5
 

thnx

scrypt3r
Junior Poster
114 posts since Aug 2007
Reputation Points: 6
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You