Jump to content

BTEC IT Unit 20 - Website Design/JavaScript/Rollover

From Wikibooks, open books for an open world

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";
    }
</script>
</head>
 
<body>
 
<div align="center">
 
<!--The rollover image displays here.-->
<img src="MyPicture1.jpg" boarder="0px" width="650px" height="550px" 
onMouseOver="MouseRollover(this)" 
onMouseOut="MouseOut(this)" />
</div>
 
</body>