Simple Image Replacement : JavaScript DHTML examples (example source code) » HTML » Image Img

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   HTML   » [  Image Img  ]   
 



Simple Image Replacement

Please note that some example is only working under IE or Firefox.


/*
Mastering JavaScript, Premium Edition
by James Jaworski 

ISBN:078212819X
Publisher Sybex CopyRight 2001
*/
<html>
<head>
<title>Replacing Images</title>
<script language="JavaScript">
var ix = 0
function changeImages(milliseconds) {
 window.setInterval("changeImage()", milliseconds)
}
function changeImage() {
 ++ix
 ix %= 6
 var imageRef = document.images[0]
 imageRef.src = "http://www.java2s.com/style/"+ix+".gif"
}
</script>
</head>
<body onload="changeImages(500)">
<p align="center"><img id="changeme" src="http://www.java2s.com/style/1.gif"></p>
</body>
</html>
Related examples in the same category
1.  Monitors the load process and the display of pictures
2.  Image Animation
3.  Image array
4.  Replace image
5.  An animating image
6.  Mouse in image and out
7.  Scrolling Image
8.  Change the height of an image
9.  Change image
10.  Change image width
11.  Count images in a document
12.  Image Event Handling
13.  Methods and Properties of the Image Object
14.  Testing an Image's align Property
15.  A Scripted Image Object and Rotating Images
16.  Scripting image.complete
17.  Changing Between Still and Motion Images
18.  Image Error Finder
19.  Image element
20.  Image Roller Machine








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.