celticking
Technical User
I have used some javascript to show a main picture on my page. Below is 3 thumbnails that when clicked should replace the main picture but doesn't work. When i open the page, everything is in place, when i select the thumbnail, the main picture area goes blank with the little not found cross in the top left corner. Here is the code i have used.
<head>
<SCRIPT LANGUAGE="JavaScript">
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft" >= 0 && browserVer >= 4);
function doPic(imgName) {
if (ns3up || ie4up) {
imgOn = ("" + imgName);
document.mainpic.src = imgOn;
}
}
</script>
<body>
<table width=165 height=220 border=0 cellspacing=0 cellpadding=0>
<tr>
<td colspan=4 align=center height="180">
<img name="mainpic" src="art/pic1.jpg" width=168 height=180 border=0></td>
</tr>
<tr>
<td width="54" height="65" valign="top">
<a href="javascript:doPic('pic2.jpg');">
<img src="art/pic2.jpg" width=54 height=63 border=1></a></td>
<td width="54" valign="top">
<a href="javascript:doPic('pic3.jpg');">
<img src="art/pic3.jpg" width=54 height=63 border=1></a></td>
<td width="54" valign="top">
<a href="javascript:doPic('pic4.jpg');"><img src="art/pic4.jpg" width=54 height=63 border=1>
</a></td>
I hope someone can help with this. I've been pulling my hair out all day as it look correct to me.
Many thanks.
<head>
<SCRIPT LANGUAGE="JavaScript">
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft" >= 0 && browserVer >= 4);
function doPic(imgName) {
if (ns3up || ie4up) {
imgOn = ("" + imgName);
document.mainpic.src = imgOn;
}
}
</script>
<body>
<table width=165 height=220 border=0 cellspacing=0 cellpadding=0>
<tr>
<td colspan=4 align=center height="180">
<img name="mainpic" src="art/pic1.jpg" width=168 height=180 border=0></td>
</tr>
<tr>
<td width="54" height="65" valign="top">
<a href="javascript:doPic('pic2.jpg');">
<img src="art/pic2.jpg" width=54 height=63 border=1></a></td>
<td width="54" valign="top">
<a href="javascript:doPic('pic3.jpg');">
<img src="art/pic3.jpg" width=54 height=63 border=1></a></td>
<td width="54" valign="top">
<a href="javascript:doPic('pic4.jpg');"><img src="art/pic4.jpg" width=54 height=63 border=1>
</a></td>
I hope someone can help with this. I've been pulling my hair out all day as it look correct to me.
Many thanks.