| <SCRIPT>
var colorArray = new Array("red", "yellow",
"green", "purple", "orange",
"blue");
// we are passing the name of the image
to the function
function swapImage(imageName)
{
// the line
below is identical to the Random Idea Generator
var Index = Math.round((colorArray.length
- 1) * Math.random());
// the
document Array holds all the Objects found within the document Object
// we
can reference an Object using the document Array either by using numbers
or
// by
using the name of the of the Object - here we are using the name 'one'
document[imageName].src = "images/" +
colorArray[Index] + ".gif";
}
</SCRIPT>
<BODY>
Stroke the squares
swapImage('one') the
argument that gets passed to swapImage is the name of the Image.
<A HREF="javascript:void("")"
onMouseOver="swapImage('one');">
<IMG SRC="images/red.gif"
NAME="one">
</A> |