Image Event Handling : JavaScript DHTML examples (example source code) » HTML » Image Img

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



Image Event Handling

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>Image Event Handling</TITLE>
<SCRIPT LANGUAGE="JavaScript"><!--
function imageLoaded() {
 document.bgColor="#FFFFFF"
 alert(document.images[0].src+" has been loaded.")
}
function imageAborted() {
 alert("Hey! You just aborted the loading of the last image!")
}
function imageError() {
 alert("Error loading image!")
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Image Event Handling</H1>
<P>An image is loaded after this paragraph.</P>
<IMG SRC="http://www.java2s.com/style/logo.png"
 onLoad="imageLoaded()"
 onAbort="imageAborted()"
 onError="imageError()">
</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.  Methods and Properties of the Image Object
13.  Testing an Image's align Property
14.  A Scripted Image Object and Rotating Images
15.  Scripting image.complete
16.  Changing Between Still and Motion Images
17.  Simple Image Replacement
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.