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

graphxdivaAsked:
Who is Participating?
 
Tomarse111Connect With a Mentor Commented:
You simply need to change:

<script language="javascript" type="application/javascript">

to

<script language="javascript" type="text/javascript">

Your code works then.
0
 
ASPSQLServerCOMCommented:
<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>

0
 
ASPSQLServerCOMCommented:
Showing and Hiding a DIV using CSS and Javascript

http://www.netlobo.com/div_hiding.html
0
 
graphxdivaAuthor Commented:
Figured it was something simple.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.