wasabi
12-18-2003, 09:49 AM
I have two frames split horizonally, assume the frame names are top and bottom
i have a link on top frame whenever i click the link i want to hide layer on the bottom frame, somehow i could not reference right , can someone help and fix my code?
Top frame code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="javascript">
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}
function showlayer(lay) {
if (ie4) {document.all[lay].style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}
}
function clicklink(){
hidelayer("layer1"); //this works fine since it is in the same frame
// here should be code to hide layer2 on the bottom frame, but how???
}
</script>
</head>
<body>
<a href="target.cfm" target="bottom" onclick="javascript: clicklink();">link1</a>
<br>
<span id="layer1">
this is top frame
</span>
</body>
</html>
++++++++++++++++++++++++++++++
bottom frame:
<div id="layer2">
this is the bottom frame
</div>
thank you
i have a link on top frame whenever i click the link i want to hide layer on the bottom frame, somehow i could not reference right , can someone help and fix my code?
Top frame code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="javascript">
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}
function showlayer(lay) {
if (ie4) {document.all[lay].style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}
}
function clicklink(){
hidelayer("layer1"); //this works fine since it is in the same frame
// here should be code to hide layer2 on the bottom frame, but how???
}
</script>
</head>
<body>
<a href="target.cfm" target="bottom" onclick="javascript: clicklink();">link1</a>
<br>
<span id="layer1">
this is top frame
</span>
</body>
</html>
++++++++++++++++++++++++++++++
bottom frame:
<div id="layer2">
this is the bottom frame
</div>
thank you