Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hiding layers

Status
Not open for further replies.

blueindian1

Programmer
Apr 24, 2001
150
US
hello,

i have this code(simplified):

Code:
<!-- container.asp -->
<iframe src=&quot;source.asp&quot; border=&quot;0&quot; height=&quot;400&quot; with=&quot;100&quot;></iframe>

and this code:

Code:
<!-- source.asp -->
<%

Option Explicit
Response.Buffer=True

%>

<script language=&quot;javascript&quot;>
function show(obj) 
{
    // show/hide the divisions
    if (obj=='one')
    {
    alert('called');
        document.all['one'].style.visibility = 'visible';
    document.all['two'].style.visibility = 'hidden';
    document.all['three'].style.visibility = 'hidden';
    }
    
    else if (obj=='two')
    {
    document.all['two'].style.visibility = 'visible';
    document.all['one'].style.visibility = 'hidden';
    document.all['three'].style.visibility = 'hidden';
    }
    else if (obj=='three')
    {
    document.all['three'].style.visibility = 'visible';
    document.all['one'].style.visibility = 'hidden';
    document.all['two'].style.visibility = 'hidden';
    }
}

</script>
<form autocomplete=&quot;NO&quot; name=&quot;test&quot; method=&quot;POST&quot; action=&quot;source.asp&quot; target=&quot;new&quot;>
<table>

<div id=&quot;one&quot; style=&quot;position:absolute; left:1px; top:1px&quot;>

    one<br>
    one<br>
    one<br>

</div>

<div id=&quot;two&quot; style=&quot;position:absolute; left:1px; top:1px&quot;>

    two<br>
    two<br>
    two<br>

</div>

<div id=&quot;three&quot; style=&quot;position:absolute; left:1px; top:1px&quot;>
  <tr>
    <td>
    <input type=text>
    </td>
  </tr>
</div>
</form>
<!-- run script to hide hotel and auto -->
<script language=&quot;javascript&quot;>
    document.all['one'].style.visibility = 'hidden';
    document.all['two'].style.visibility = 'hidden';
    document.all['three'].style.visibility = 'visible';
</script>

<tr>
<td colspan=&quot;3&quot;>
<a href=&quot;javascript:show('one');&quot;>one</a>
<a href=&quot;javascript:show('two');&quot;>two</a>
<a href=&quot;javascript:show('three');&quot;>three</a>
</td>
</tr>
</table>

ok, here's the problem. when the page loads, layers One and Two are hidden and Three is visible. clicking on either the 'One' or 'Two' link causes those layers to be shown, but layer 'Three' will not hide. when i click 'One', layer one is shown on top of layer three. when i click two, layer one is hidden and layer two is shown on top of layer three.

now for the tricky part. if i replace the input box in layer three with text, it will then hide itself if the 'one' or 'two' link is clicked. or, if i replace the text in either layer one or two with an input box(or table tags, <br>, or anything), those layers will no longer hide.

what gives?


 
nevermin.

you have to have each layer enclosed in its own table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top