12.8.1 The onError EventThe error event fires when a JavaScript error has occurred (window) or when an image cannot be found (image elements). Example 12.21<html><head><title>Wake up call</title> <script language="javascript"> function wakeupCall(){ // Function is defined here timeout=setTimeout('alert("Time to get up!")',2000); } </script> </head> <body bgcolor="white"> <form> <center> <p> 1 <image src="Image/java_steam.gif" 2 onError="alert('Image is having trouble loading!')"> <p> <input type="button" value="Wake me" onClick="wakeupCall()"> </form> <center> </body> </html> EXPLANATION
|