View Full Version : problems with layers

06-21-2004, 03:16 PM

I am fairly new to javascripting and am wondering if there is a way I can pass content from a link to a layer.

What I mean is If I have a list of images with links attached to them to various texts, can I call each one separately when the appropriate link is clicked??


06-21-2004, 04:32 PM
I believe it's possible...if I understand you correctly...

you may have a few links like

#link 1 - more info
#link 2 - more info

- the more info bit being the hyperlink?

you could then have a DIV layer named "more_info" and set it's innerHTML property to display the information. Something like:

<script language="javascript">
function moreInfo(id)
var set = document.all['more_info'].innerHTML;
switch(id) {
case "1": set = "<p>This is more info about link 1</p>"; break;
case "2": set = "<p>This is more info about link 2</p>"; break;

so the hyperlinks would look something like

#link 1 - <a href="#" onclick="javascript:moreInfo('1')">more info 1</a>
#link 2 - <a href="#" onclick="javascript:moreInfo('2')">more info 2</a>


is that the sort of thing you were looking for?