Could anyone please help me to find out why my javascript doesn’t work under Firefox? I have tested it in IE. It works with no problem. Thanks in advance!
The code is here:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<title></title>
<meta name=”description” content=””>
<meta name=”keywords” content=””>
<meta name=”author” content=”Unregistered User”>
<meta name=”generator” content=”AceHTML 6 Pro”>
</head>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript”type=”text/javascript”>
//Set the numbers of images for the navigation
var numbersOfImages = 6;
/*isDown is the variable for the state of images.
Zero means no image has been clicked.
Otherweise menas a image with the value of isDown as index
has been clicked. */
var isDown = 0;
//By loading of the page all images will be set with “taste_oben.gif”.
function onLoad(){
for (i = 1; i <= numbersOfimages; i++ ){
document[‘taste0’ + i].src = “taste_oben.gif”;
}
}
/*On mouse over swap the original image with “taste_unten.gif”,
which has not been clicked.*/
function swapOver(imgIndex){
if (imgIndex != isDown){
document[‘taste0’ + imgIndex].src = “taste_down.gif”;
}
}
/*On mouse out restore the images with “taste_oben.gif”,
which has not been clicked.*/
function swapOut(imgIndex){
if (imgIndex != isDown){
document[‘taste0’ + imgIndex].src = “taste_up.gif”;
}
}
//On click swap the clicked image with “taste_down.gif”.
function swapClick(imgIndex){
//No image has been clicked, if isDown equals zero.
if (isDown != 0){
//When a image has been clicked, restore it with “taste_up.gif”.
document[‘taste0’ + isDown].src = “taste_up.gif”;
}
/*Swap the image that has been newly clicked with “taste_down.gif”
and set the value of isDown with the index of this image. */
document[‘taste0’ + imgIndex].src = “taste_unten.gif”;
isDown = imgIndex;
}
</script>
</HEAD>
<BODY>
<center>
<table>
<tr>
<td valign=”top” align=”left”>
<a href=”#”><img name=”taste01″ src=”taste_oben.gif”
border=”0″ onmouseover=”swapOver(1)” onmouseout=”swapOut(1)”
onclick=”swapClick(1)”></a>
</td>
<td valign=”top” align=”center”>
<a href=”#”><img name=”taste02″ src=”taste_oben.gif”
border=”0″ onmouseover=”swapOver(2)” onmouseout=”swapOut(2)”
onclick=”swapClick(2)”></a>
</td>
<td valign=”top” align=”right”>
<a href=”#”><img name=”taste03″ src=”taste_oben.gif”
border=”0″ onclick=”swapClick(3)” onmouseover=”swapOver(3)”
onmouseout=”swapOut(3)”></a>
</td>
<td valign=”top” align=”right”>
<a href=”#”><img name=”taste04″ src=”taste_oben.gif”
border=”0″ onclick=”swapClick(4)” onmouseover=”swapOver(4)”
onmouseout=”swapOut(4)”></a>
</td>
<td valign=”top” align=”right”>
<a href=”#”><img name=”taste05″ src=”taste_oben.gif”
border=”0″ onclick=”swapClick(5)” onmouseover=”swapOver(5)”
onmouseout=”swapOut(5)”></a>
</td>
<td valign=”top” align=”right”>
<a href=”#”><img name=”taste06″ src=”taste_oben.gif”
border=”0″ onclick=”swapClick(6)” onmouseover=”swapOver(6)”
onmouseout=”swapOut(6)”></a>
</td>
</tr>
</table>
</center>
</BODY>
</html>