Tuesday, December 7, 2010

onMouseDown in Javascript


Code 1 : move mouse to produce alert
<html> <body> <img src="image_w3default.gif" onMouseDown="alert('You clicked the picture!')" width="234" height="91" /> <p>Click the picture</p>  </body> </html>

Code 2: move  mouse to change webpage to pink
<body  onMouseDown="document.bgColor='pink'" > <p>Mouse click to turn to pink</p>  </body>

No comments:

Post a Comment