mouseovers work fine in FF, c, o & s, but not in ie8.

Why?

<!-- Based on changing temp11e.php code to produce html from b7b.php in this script code-->
<!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 name="description" content="Save money" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>savebop </title>
<script type="text/javascript">
//<![CDATA[

function showmenu(elmnt)
{
outerdiv=document.getElementById(elmnt);
outerdiv.style.visibility="visible";

//now target ALL divs within it using function
innerdivchange(outerdiv,"visible");
}

function hidemenu(elmnt)
{
outerdiv=document.getElementById(elmnt);
outerdiv.style.visibility="hidden";

//now target ALL divs within it using function
innerdivchange(outerdiv,"hidden")
}


function innerdivchange(outerdiv,vis_state)
{
//now target ALL divs within it
innerdivs=outerdiv.getElementsByTagName("div");

for(i=0;i<innerdivs.length;i++)
{
innerdivs[i].style.visibility=vis_state;
}
}
//]]>
</script>
<style type="text/css">
body{font-family:arial;}
a.three{display:inline;font-size:50%;text-decoration:none;height:40px;}
a.three:visited {color:blue;}
a.three:hover {color:red;}
span:hover {color:red;}
select {color:blue;}
div.one {
  color:blue;
  font-size:175%;
  min-width:275px;
  float:left;
  overflow:visible;
}
.links {margin: 5px 0 0 -2px;height:30px;padding-top:5px;}
div.one2 {
  visibility:hidden;
  min-width:200px;
}  
</style>
</head>
<body>

<div style="clear:both;margin-bottom:20px;"></div>

<div onmouseover="showmenu('all')" onmouseout="hidemenu('all')">
<div style="margin-left:60px;">
<div class="one"><span>View All Bops</span></div>
<div class="one2" id="all">
<div class="one links"><a class="three" href="newest1st.php">Newest First</a></div>
<div class="one links"><a class="three" href="newest1st.php">Biggest Percent Off</a></div>
<div class="one links"><a class="three" href="newest1st.php">Most Money Off</a></div>
</div>
</div>
</div>

</body>
</html>

I've been dealing with this most of the day and I just discovered that the comment I put at the very top of my script was the problem.

Why did this comment ruin my script on ie8????:

<!-- Based on changing temp11e.php code to produce html from b7b.php in this script code-->

Because it comes before the doctype. IE relies on html pages starting with a correct doctype (and not with an empty line followed by a comment).

Thanks pritaeas. I won't do that again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.