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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggle Layer Display

Status
Not open for further replies.

hedidit

Technical User
Jul 21, 2005
142
GB
Hi all, I have a screen that lists records froma database using ASP. Each record has a small icon that when clicked displays further details by aking a hidden layer visible. Problem is that when the user scrolls the screen etc the layer still appears at the top of the screen as I've used absolute positing.

I've realised I need to use relative positioning but am now having problems as the layers are in a table and make the cells really deep etc. To get round this I think i need to use display:none but I'm not sure how to change the toggle display of layer code I have, the code is:

Code:
<script language="JavaScript1.2">

/*
Toggle Layer Visibility
© Eddie Traversa (nirvana.media3.net)
To add more shock to your site, visit [URL unfurl="true"]www.DHTML[/URL] Shock.com
*/

function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
            }
        }
    }
}
</script>

the start of my div layer code is:

Code:
<td>
<Font face="Arial" size="2">
<%=(lg.Fields.Item("Description").Value)%>
<a href="javascript:;" onClick="toggleVisibility('sEdit<%=cnt%>','show','visible','visible')"><img src="images/qe.gif" border="0"></a>

 
<DIV id="sEdit<%=cnt%>" style="position:relative;top:100px;left:10px;visibility:hidden;display:none">
<Form name="QE<%=cnt%>" action="BA.asp" method="post">
<Table bgcolor="#ffcc88" width="100%">
<tr bgcolor="#ff9900">

Can anyone help me with this? I hardly ever use anything other than basic HTML and ASP!

Cheers
 
This is a question suited for forum216, because you will need to change Javascript to toggle the display property. That said, your code is overly complex and you actually shouldn't have any positioning at all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top