[Javascript] Using same script twice with modifications

Richard nomorebull at charter.net
Fri Feb 4 22:11:58 CST 2005


var kid = "FirstOn"
function ShowInfo(DivId)
  {
  document.getElementById(kid).style.display = 'none';
  document.getElementById(DivId).style.display = 'block';
  kid = DivId;
  }


var picdesc = "BigPic"
function ShowPic(PicId)
  {
  document.getElementById(picdesc).style.display = 'none';
  document.getElementById(PicId).style.display = 'block';
  picdesc = PicId;
  }


Both are identical except for variable names.
Here's what I am attempting to do that is not working.
Column A is the original menu. Which "FirstOn" is activated by.
This brings up a list of thumbnails.
Which are shown in column B.
When the thumbnail is clicked on, [theory] is to erase the current content
of column C and replace it with large image and a description.
The original content of column C is properly displayed on load.
It goes blank when I click the thumbnail and I get an error.
"Line nn, char 1....object expected....code 0"
This is line nn>>   <a href="#" onclick="BigPic('desc2')" ><img
src="images/thmb999.jpg"></a>

I am thinking that this is due to the double usage of "getelementbyid".
I also tried using getelementbyclass and that gives the same error.

Anyone have any ideas on how to correct this so I can do the passing over as
I want?
I don't want a simple image swap as I also want to include descriptions for
each image.
I've tried a script like dynamicdrive's textual tooltip, but this script
seems to work better for my needs.

As the old saying goes, "KISS IT!"
Keep It Simple Stupid!

Thanks.




More information about the Javascript mailing list