SunQuest
           HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 13th, 2000, 02:48 PM
$tACK$ $tACK$ is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 3 $tACK$ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!!!

Reply With Quote
  #2  
Old April 13th, 2000, 04:35 PM
Spookster Spookster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 1999
Posts: 84 Spookster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > DIV and LAYERS one shows the other doesn't


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway