In fact cleaning up the javascript fixed the problem. The crucial part seems to have been the use of the id string as text and then getting the object, rather than treating it as an object directly. For some reason, IE allows this.
The other comments about validation are of course correct. The code snippet I posted in the question is not from our web site but from a posting somewhere on the web that demontrates the concept. Our site is periodically run through the validators, and the specific issues you point our do not apply.
the code on our site is vastly more complex, and I wanted a simplistic example.
Main Topics
Browse All Topics





by: GrandSchtroumpfPosted on 2005-12-16 at 17:28:37ID: 15502329
That's because you use non-standard javascript.
4/strict.d td"> Id); Id);
0,50)">
Also, make sure your html code validates. The header was not closed properly the script tag was missing the "type" and <input> cannot be a direct child of the <body> element).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html
<html>
<head>
<script type="text/javascript">
function popup( myId, L, T ) {
obj = document.getElementById(my
with( obj.style ) {
display = "block";
position = "absolute";
left = L + "px";
top = T + "px";
}
}
function unpop( myId ) {
obj = document.getElementById(my
obj.style.display = "none";
}
</script>
</head>
<body>
<div>
<input type="button" value="Pop DIV" onclick="popup('myitem',10
</div>
<div id="myitem" style="display: none;">
<input type="button" value="Click Me" onclick="unpop('myitem')" >
</div>
</body>
</html>