Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2007
Posts: 113
Reputation: scrypt3r is an unknown quantity at this point 
Solved Threads: 2
scrypt3r's Avatar
scrypt3r scrypt3r is offline Offline
Junior Poster

picture change

 
0
  #1
Aug 13th, 2007
does any 1 know how to give a picture a tag or name and then in javascript or vbscript change it ?
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: picture change

 
0
  #2
Aug 13th, 2007
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...
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 113
Reputation: scrypt3r is an unknown quantity at this point 
Solved Threads: 2
scrypt3r's Avatar
scrypt3r scrypt3r is offline Offline
Junior Poster

Re: picture change

 
0
  #3
Aug 14th, 2007
thnx
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC