PDA

View Full Version : Problem: link from one conveyor belt (layer1) to second conveyor belt (layer2)



BTC
07-23-2005, 12:07 PM
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)

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)


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


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

BTC
07-24-2005, 10:39 AM
Ok I figured out by myself:

put this between Head


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

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 :rolleyes: