Hey everyone, I'm working on a web application that's supposed to be compatible with all browsers, yet IE, as usual, is giving me one hell of a headache. I'm posting the code below, it's very straightforward... 3 divs containing ordered lists are made hidden/unhidden via a select menu.
The problem occurs when you select one item from the menu, then selecting another item higher up in the menu.
For example: selecting Super, followed by selecting Standard, makes the numbers in the ordered list all 0's. This doesn't happen in any browser other than IE and I just don't get what I'm doing wrong or why it's doing that. If anybody has an answer I would really appreciate the help... cheers!
<!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" />
<script type="text/javascript">
function doit()
{
document.getElementById("list1").style.display="none";
document.getElementById("list2").style.display="none";
document.getElementById("list3").style.display="none";
if(document.getElementById("model").value=="lux") document.getElementById("list2").style.display="block";
else if(document.getElementById("model").value=="super") document.getElementById("list3").style.display="block";
else document.getElementById("list1").style.display="block";
}
</script>
</head>
<body onload="doit()">
Model: <select id="model" onchange="doit()">
<option selected="selected" value="standard">Standard</option>
<option value="lux">Lux</option>
<option value="super">Super</option>
</select>
<div id="list1"><ol><li>bla</li><li>bla</li><li>bla</li></ol></div>
<div id="list2"><ol><li>bla</li><li>bla</li><li>bla</li><li>bla</li></ol></div>
<div id="list3"><ol><li>bla</li><li>bla</li><li>bla</li><li>bla</li><li>bla</li></ol></div>
</body>
</html>