View Full Version : Cannot execute a css script through IE9,works fine with Mozilla

09-08-2011, 10:13 AM
I need to get the below mentioned code working in IE9,it works absolutely fine with Firefox.
I have included the DOCTYPE,meta for ie9,set the browser mode to IE9 Compatibility view and Document mode to IE9,but it still doesn't work.

Any help would be appreciated.

CSS code:clmenu.css

.mC {width:100px; margin:5px; float:right;}
.mH {color:#60c; cursor:pointer; font-weight:bold; border-top:1px solid #300;}
.mL {display:none; margin-bottom:10px;}
.mO {margin-left:10px; display:block;}

Javascript: clmenu.js

function toggleMenu(objID) {
if (!document.getElementById) return;
var ob = document.getElementById(objID).style;
ob.display = (ob.display == 'block')?'none': 'block';

HTML: clmenu.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="en-us" />
<script src="clmenu.js" type="text/javascript"></script>
<link href="clmenu.css" type="text/css" rel="stylesheet" />
<div class="mC">
<div class="mH"
onclick="toggleMenu('menu1')">+ Collapsible</div>
<div id="menu1" class="mL">
<a class="mO" href="blclmenu1.htm">Head Script</a>
<a class="mO" href="blclmenu2.htm">Stylesheet</a>
<a class="mO" href="blclmenu3.htm">Add Menus</a>
<div class="mH"
onclick="toggleMenu('menu2')">+ Dropdown</div>
<div id="menu2" class="mL">
<a class="mO" href="blmenu.htm">Introduction</a>
<a class="mO" href="blmenu1.htm">Head Script</a>
<a class="mO" href="blmenu2.htm">Customize</a>
<a class="mO" href="blmenu3.htm">Body Script</a>


09-08-2011, 01:18 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Strict//EN"

There is no such a Doctype. I suspect you wanted to use an XHTML DTD, thus:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

Or you may simply use an HTML5 DTD, which will render properly an XHTML strict code, if it is well formatted.