Please contact (802) 224 - 6525 for price quotes and programming support.
Follow this link for a resume of php and Mysql Programing experience
Digg This!

0 Members and 1 Guest are viewing this topic. « previous next »

Pages: [1] Go Down Print
Author Topic: javascript Swap image function. How to create a rollover with javascript dom.  (Read 3561 times)
John Anderson
Vermont Internet Design Admin
Administrator
Full Member
*****

Karma: 0
Offline Offline

Gender: Male
Posts: 238



View Profile WWW
« on: October 12, 2007, 04:04:25 AM »

Changing the value of an image with javascript is relatively easy if you take advantage of the document object module. You can change the src attibute of the image take like this:


 In the image tag that you would like to be changed put name attibute like this
  <img src="imagetostart.jpg" name="imagetochage" />

To change this vaule using javascript we will show you using onClick but can obviously be used for another event as well. You can imply reference the attibuite like so:
document.imagetochagne.src='newimage.jpg';

<a href="javascript:;"onClick="document.imagetochagne.src='newimage.jpg';">Text to click[/url]
Logged

Pages: [1] Go Up Print 
« previous next »
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Christmas2006 design by Bloc
Page created in 0.378 seconds with 29 queries.