oops, left off the quote ... use 'show' instead of 'visible' for NS4 ... but this alone will not solve your issues.
Main Topics
Browse All Topicshi all experts,
A question about <DIV> visibility. It is workable on IE but it seems not correct on ns. There are three layers, user can select an image to display different layer. The code is as follows:
<script>
function doClick()
{
//assume to display layer1 always
if (document.layers) // netscape4
{
document.layers['layer1'].
document.layers['layer2'].
document.layers['layer3'].
}
}
function initLayers()
{
if (document.layers) // netscape4
{
document.layers['layer1'].
document.layers['layer2'].
document.layers['layer3'].
}
}
</script>
<div id='layer1' TOP=100 LEFT=100 visibility:hidden>whatever
<div id='layer2' TOP=100 LEFT=100 visibility:hidden>whatever
<div id='layer3' TOP=100 LEFT=100 visibility:hidden>whatever
<script> initLayers();</script>
Question 1: After loading the page, all layers will be display. How to fix it to show layer1 only?
Question 2: When system call the "doClick" function, it is no response. Please give me help. Thx!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
<script>
function doClick()
{
//assume to display layer1 always
if (document.layers) // netscape4
{
document.layers['layer1'].
document.layers['layer2'].
document.layers['layer3'].
}
}
</script>
<div id='layer1' name="layer1" style="position:absolute;T
<div id='layer2' name="layer2" style="position:absolute;T
<div id='layer3' name="layer3" style="position:absolute;T
Shouldn't need any initLayers function just to initially hide or display. Now when you call doClick() visibility can be altered.
The method that ahosang proposes is the bet approach. Using just div tags makes it easier to maintain, but to be referenced as a netscrap layer the div must have absolute positioning applied. You do not indicate what you are calling it from, but be aware that most elements in Netscrap will not support an onClick event.
Cd&
This has always worked for me. Give it a shot. Also, what browser versions are you aiming at?
jdog22
<style type="text/css">
#mnuOwm {position: absolute; visibility: hidden; left: 10; top: 65;};
</style>
function showlayer(n) {
if (document.all) {
document.all[n].style.visi
}
else {
document[n].visibility = "show"
}
}
function hidelayer(n) {
if (document.all) {
document.all[n].style.visi
}
else {
document[n].visibility = "hide"
}
}
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
In the absence of responses, I may recommend DELETE unless it is clear
to me that it has value as a PAQ. Silence = you don't care
</note>
Cd&
Business Accounts
Answer for Membership
by: knightEknightPosted on 2002-12-02 at 12:12:15ID: 7521780
document.layers['layer1']. visibility = 'show; // 'visible';