|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
when I use this javascript:
function inView(num){ if (num==1){ show('existing'); hide('new'); } else show('new'); hide('existing'); } function show(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility='visible'; else if (document.all) document.all[object].style.visibility='visible'; } function hide(object) { if (document.layers && document.layers[object] != null) document.layers[object].visibility='hidden'; else if (document.all) document.all[object].style.visibility='hidden'; } The 'new' layer is shown and the existing is hidden. BUT when I try to show the 'existing' layer, it doesn't show, but the 'new layer goes away. this is some html that calls it: <center> <input type=button value="Use NEW Library" onClick="inView(2);"> <input type=button value="Use EXISTING Library" onClick="inView(1);"> this is how I made the layers: <DIV id="existing" style="position:absolute; left:10px; top:300px; width:100%; height:1000; visibility:visible"> <DIV id="new" style="position:absolute; left:10px; top:300px; width:100%; height:200px; visibility: hidden"> Please HELP!!! |
|
#2
|
|||
|
|||
|
Here is a script I put together. It's essentially like yours but this works:
<html> <head> <title>Hide/Show Multiple Layer Script</title> <script language="JavaScript"> <!--// function show(layerid) { if (document.all){ layerid.style.visibility="visible" } else if(document.layers){ layerid.visibility="show" } } function hide(layerid){ if (document.all){ layerid.style.visibility="hidden" } else if(document.layers){ layerid.visibility="hide" } } //--> </script> </head> <body> <a href="javascript:void(null);" onClick="show(myText01);">Show Text 01</a><br> <a href="javascript:void(null);" onClick="hide(myText01);">Hide Text 01</a><br> <br> <a href="javascript:void(null);" onClick="show(myText02);">Show Text 02</a><br> <a href="javascript:void(null);" onClick="hide(myText02);">Hide Text 02</a><br> <div id="myText01" style="position:relative;visibility:visible"> <h1>Here is some text</h1> </div> <div id="myText02" style="position:relative;visibility:visible"> <h1>Here is some more text</h1> </div> </body> </html> Spookster |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > DIV and LAYERS one shows the other doesn't |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|