/    Sign up×
Community /Pin to ProfileBookmark

hide layer not working on netscape

I am using this script to show hide layers;

<head>
<script type=”text/javascript”>

function show(id)
{
eval(“document.all.” + id + “.style.visibility = ‘visible’;”);
return;
}

function hide(id)
{
eval(“document.all.” + id + “.style.visibility = ‘hidden’;”);
return;
}

</script>
</head>
<body>
<a href = “#” onclick = “hide(‘layer1’);”
</body>

This works fine on IE and Opera but it isn’t working on Mozilla or Netscape7. Any ideas why? Or what I should use?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@vargonauthorMar 24.2003 — nothing on that link.

got any others?
Copy linkTweet thisAlerts:
@khalidali63Mar 24.2003 — LoL...my fault the link I posted earlier only works with NS4+ but <6 browsers

try this..typically there is not much diff between IE6+ or NS6+ browsers functionality for hiding or showing a layer

http://68.145.35.86/skills/javascripts/ShowHideFormElement.html

Cheers

Khalid
Copy linkTweet thisAlerts:
@gil_davisMar 25.2003 — Mozilla and NS do not support document.all. That is an IE only thing. You should use the W3C DOM method document.getElementById(). The following will work in the majority of browsers:function show(id) {
if (document.getElementById)
{document.getElementById(id).style.visibility = "visible";}
else
{if (document.layers)
{document.layers[id].visibility = "show";}
else
{document.all[id].style.visibility = "visible";}
}
}
×

Success!

Help @vargon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.30,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...