?
Solved

Show / Hide div not working in IE6

Posted on 2008-11-12
4
Medium Priority
?
1,918 Views
Last Modified: 2012-05-05
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

0
Comment
Question by:graphxdiva
  • 2
4 Comments
 
LVL 7

Expert Comment

by:ASPSQLServerCOM
ID: 22940603
<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
 
LVL 7

Expert Comment

by:ASPSQLServerCOM
ID: 22940612
Showing and Hiding a DIV using CSS and Javascript

http://www.netlobo.com/div_hiding.html
0
 
LVL 15

Accepted Solution

by:
Tomarse111 earned 2000 total points
ID: 22940658
You simply need to change:

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

to

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

Your code works then.
0
 

Author Closing Comment

by:graphxdiva
ID: 31515976
Figured it was something simple.  Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question