Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-31-2004, 05:06 PM   #1 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Small modification needed on image flipping JavaScript

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.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:07 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting