misheck
12-20-2008, 01:42 PM
I am trying to write a simple rollover image script but it displays the image when loaded but when I move the mouse over or out it cannot display the image. I have downloaded a few scripts to use for the same effect but I am learning javascript and I would love to be able to do a few basic scripts on my own so as to help me in modifying the ones available. Here is the code I have done
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="">
<title>Untitled 1</title>
<script language="Javascript" type="text/javascript">
var myImages = new Array("orange.jpg","banana.jpg");
var imgClicked1 = myImages[0];
var imgClicked2 = myImages[1];
</script>
</head>
<body>
<a href="" onmouseover="document.images['example'].src=imgClicked1.src"
onmouseout="document.images['example'].src=imgClicked2.src">
<img src="orange.jpg" name="example"></a>
</body>
</html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="">
<title>Untitled 1</title>
<script language="Javascript" type="text/javascript">
var myImages = new Array("orange.jpg","banana.jpg");
var imgClicked1 = myImages[0];
var imgClicked2 = myImages[1];
</script>
</head>
<body>
<a href="" onmouseover="document.images['example'].src=imgClicked1.src"
onmouseout="document.images['example'].src=imgClicked2.src">
<img src="orange.jpg" name="example"></a>
</body>
</html>