Results 1 to 2 of 2

Thread: Problem: link from one conveyor belt (layer1) to second conveyor belt (layer2)

  1. #1
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem: link from one conveyor belt (layer1) to second conveyor belt (layer2)

    I really like the conveyor belt script!!!!

    I want to press on an image in the conveyor belt (layer1), in a way that layer1 would be hidden and another conveyor belt (layer 2) will show up.

    I use dreamweaver.

    I've tried 2 different things:

    1)
    Code:
    leftrightslide[16]='<a href="#" onClick="MM_showHideLayers('layer1','','hide','layer2','','show')><img src="Menu/The_diary_of_bill.gif" onMouseOver="this.src=The_diary_of_bill_h.src" onMouseOut="this.src=The_diary_of_bill.src" border=no></a>'
    When i preview to see if it works, conveyor belt is gone. It doesn't work

    2) I've another code to show and hide layers.
    I put his code between the (head)(head)
    Code:
    <script language="javascript" type="text/javascript"> 
    <!-- 
    
    function showLayer(layerID) 
    { 
       if ((obj = getObj(layerID)) == false) 
       { 
          return false; 
       } 
       if (document.layers) 
       { 
          obj.visibility = "visible"; 
       } 
       else 
       { 
          obj.style.display = ""; 
       } 
    } 
    
    function hideLayer(layerID) 
    { 
       if ((obj = getObj(layerID)) == false) 
       { 
          return false; 
       } 
       if (document.layers) 
       { 
     
          obj.visibility = "hide"; 
       } 
       else 
       { 
          obj.style.display = "none"; 
       } 
    } 
    
    function getObj(layerID) 
    { 
       if (document.getElementById(layerID)) 
       { 
          return(document.getElementById(layerID)); 
       } 
       else if (document.getElementsByName(layerID)[0]) 
       { 
          return(document.getElementsByName(layerID)[0]); 
       } 
       else if (document.all[layerID]) 
       { 
          return(document.all[layerID]); 
       } 
       else if (document.layers[layerID]) 
       { 
          return(document.layers[layerID]); 
       } 
       else 
       { 
    
          return false; 
       } 
    } 
    
    //--> 
    </script>
    and this code underneath in the conveyor belt:
    Code:
    leftrightslide[16]='<a href="#" onClick="showLayer('layer2'); hideLayer('layer1');return false;"><img src="Menu/The_diary_of_bill.gif" onMouseOver="this.src=The_diary_of_bill_h.src" onMouseOut="this.src=The_diary_of_bill.src" border=no></a>'
    When i preview to see if it works, conveyor belt is gone. It doesn't work

    But, when I delete the brackets by ('layer2') and ('layer1')
    example: ' '

    the conveyor belt works but the link gives an error.

    Can annyone help me?

    thanks anyway!!!

  2. #2
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok I figured out by myself:

    put this between Head

    Code:
    <script language="JavaScript" type="text/JavaScript">
    ns4 = (document.layers) ? true:false
    ie4 = (document.all) ? true:false
    ng5 = (document.getElementById) ? true:false
    
    function hideSec() {
    if (ng5) document.getElementById('layer1').style.visibility = "hidden"
    else if (ns4) document.layer1.visibility = "hide"
    else if (ie4) layer1.style.visibility ="hidden"
    }
    
    function showSec(layer2) {
    hideSec();
    if (ng5) document.getElementById('layer2').style.visibility = "visible";
    else if (ns4) document.layers["layer2"].visibility = "show";
    else if (ie4) document.all["layer2"].style.visibility = "visible";
    }
    </script>

    and this code underneath in the conveyor belt:
    Code:
    leftrightslide[16]='<a href="#" onClick="showSec(layer2)"><img src="Menu/The_diary_of_bill.gif" onMouseOver="this.src=The_diary_of_bill_h.src" onMouseOut="this.src=The_diary_of_bill.src" border=no></a>'


    LOL

Bookmarks

Posting Permissions

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