BTEC IT Unit 20 - Website Design/JavaScript/Rollover

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Image Rollover

<meta charset="utf-8">
<title>How to Make a JavaScript Image Rollover</title>
<!--JavaScript code goes here.-->
<script language="javascript">
        function MouseRollover(MyImage) {
         MyImage.src = "MyPicture2.jpg";
        function MouseOut(MyImage) {
                MyImage.src = "MyPicture1.jpg";
<div align="center">
<!--The rollover image displays here.-->
<img src="MyPicture1.jpg" boarder="0px" width="650px" height="550px" 
onMouseOut="MouseOut(this)" />