Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems with layers

    Hi,

    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??

    Thanks
    ashwin24

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    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:

    Code:
    <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;
    	}
    }
    </script>
    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>

    etc....

    is that the sort of thing you were looking for?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •