Link to home
Start Free TrialLog in
Avatar of graphxdiva
graphxdiva

asked on

Show / Hide div not working in IE6

As you can see from the code below, I am trying to hide / show a div when the link is clicked.  Works fine in all browsers except IE6.  Any ideas what I am doing wrong?

Thanks for any help.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script language="javascript" type="application/javascript">
function showhide(show, hide) {
	var show = document.getElementById(show);
	var hide = document.getElementById(hide);
	show.style.display = "block";
	hide.style.display = "none";
}
 
</script>
</head>
 
<body>
<center>
<div><a href="controlpanel.php">Back To Control Panel</a><br />
  <a href="javascript:showhide('bands','venues')">View Preformers</a> | <a href="javascript:showhide('venues','bands')">View Showplaces</a></div>
<div id="bands" style="width:50%; display:none; background:#FF0000; height:300px;">
  
</div>
<div id="venues" style="width:50%; display:none; background:#0000FF; height:300px;">
 
</div>
</center>
</body>
</html>

Open in new window

Avatar of ASPSQLServerCOM
ASPSQLServerCOM
Flag of United States of America image

<script language=javascript type='text/javascript'>
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';
}
}
}

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';
}
}
}
</script>

Showing and Hiding a DIV using CSS and Javascript

http://www.netlobo.com/div_hiding.html
ASKER CERTIFIED SOLUTION
Avatar of Tomarse111
Tomarse111
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of graphxdiva
graphxdiva

ASKER

Figured it was something simple.  Thanks!