I'm pretty clueless when it comes to JavaScript, I basically just copy & paste the numerous free scripts out there. This is what I have:
Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
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;
}
}
// End -->
</script>
</head>
<body>
<img name="mainpic" src="1.jpg">
<br>
<!-- Caption to go here -->
<br><br>
<a href="javascript:doPic('1.jpg');"><img src="1_th.jpg"></a>
<a href="javascript:doPic('2.jpg');"><img src="2_th.jpg"></a>
<a href="javascript:doPic('3.jpg');"><img src="3_th.jpg"></a>
<a href="javascript:doPic('4.jpg');"><img src="4_th.jpg"></a>
</body>
</html>
What it does is when a thumbnail is clicked it flips the "mainpic" image to whatever image is defined in the thumb's link. That works great, no problem.
The modification that I need is where you see the comment "Caption to go here". Each picture has a different caption (just plain text) and I need to flip that, as well, when a thumbnail is clicked.
I could either define the captions within each of the <a> tags, or within the script in the document head. Either way is fine with me. I'm just not sure of how to modify it to make it actually work. And I imagine I'll need some sort of identifier tags enclosing the text that is to appear (maybe span tags? I dunno).
Any help is appreciated.