Page is a not externally linkable
rover - 12:28 am on Feb 24, 2006 (gmt 0)
With the code below the divs start out being shown, and then can be switched to being hidden, but I need the opposite. I've tried various ways with the following part of the code with no luck: ------------ function switchMenu(obj) { ------------ Here is the full code for the page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script language="JavaScript"> function SymError() window.onerror = SymError; var SymRealWinOpen = window.open; function SymWinOpen(url, name, attributes) window.open = SymWinOpen; //--> <script type="text/javascript"> <body> <p><a onclick="switchMenu('one_myvar');" title="Switch the Menu">Switch it now</a></p> <br><br> <p><a onclick="switchMenu('two_myvar');" title="Switch the Menu">Switch it now</a></p> </body> <script language="JavaScript"> function SymOnLoad() function SymOnUnload() SymRealOnLoad = window.onload; //-->
I want to use the following code to show and hide layers with Javascript and CSS, but I can't figure out how to modify the code so that the layers will start out hidden when the page is loaded.
var el = document.getElementById(obj);
if ( el.style.display!= "none" ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Switch menu</title>
<style type="text/css">
<!--
body {
text-align:center;
margin:30px;
}
#wrapper {
text-align:left;
margin:0 auto;
width:500px;
min-height:100px;
border:1px solid #ccc;
padding:30px;
}
a {
color:blue;
cursor:pointer;
}
*#myvar {
border:1px dotted #ccc;
background:#f2f2f2;
padding:20px;
width: 500px;
}
-->
</style>
<!--
{
return true;
}
{
return (new Object());
}
</script>
<!--
function switchMenu(obj) {
var el = document.getElementById(obj);
if ( el.style.display!= "none" ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}
//-->
</script>
</head>
<div id="one_myvar"><div id="myvar">
<p>Some stuff here...</p>
</div></div>
<div id="two_myvar"><div id="myvar">
<p>Some stuff also here..</p>
</div></div>
</html>
<!--
var SymRealOnLoad;
var SymRealOnUnload;
{
window.open = SymWinOpen;
if(SymRealOnUnload!= null)
SymRealOnUnload();
}
{
if(SymRealOnLoad!= null)
SymRealOnLoad();
window.open = 'SymRealWinOpen';
SymRealOnUnload = window.onunload;
window.onunload = SymOnUnload;
}
window.onload = SymOnLoad;
</script>