View Single Post
02-17-2007, 07:45 PM
#1
t0m is offline t0m
Status: Request a custom title
Join date: Jan 2005
Location: West Sussex, England
Expertise:
Software:
 
Posts: 2,829
iTrader: 21 / 100%
 

t0m is on a distinguished road

  Old  Bit of help needed!

Ok im just trying to show/hide a div - everything on this script is working perfect BUT i want it to be hidden when the page loads...(at the momment it shows by default).

Thanks for the help!

Code:
<html>

<head>
<title>Test!</title>

<script language=javascript type='text/javascript'>
document.onload=hidelayer;

function showdiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'visible';
}
else { // IE 4
document.all.hideshow.style.visibility = 'visible';
}
}
}
function hidediv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'hidden';
}
else { // IE 4
document.all.hideshow.style.visibility = 'hidden';
}
}
}


</script> 

</head>

<body>

<a href="javascript:hidediv()">hide div</a>
<a href="javascript:showdiv()">show div</a>

<div id="hideshow">
My content test, please hide show!
</div>
</body>

</html>