Richard Cornford wrote:
The - document.getElementById - method in IE does _not_ever_ return a
collection. It returns either a reference to a single Element node or
null.
Right, that must be not my week :-(
I was thinking about getElementByName weirdness in IE.
Here is a summary of the most weird things (by my scale) IE does:
<html>
<head>
<title>IE in all its beauty</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function init(){
// 1) IE doesn't distinct names and id's in getElementById
// whatever it sees first - this it returns:
var obj = document.getElementById('shipping');
alert(obj.tagName); // "FORM"
// 2) IE creates parasite global vars for each id'ed element:
try {shipping = 'UPS';}
catch(e) {alert(e.message);} // error
// 3) getElementsByName returns all elements with matching
// name OR id
var elm = document.getElementsByName('shipping');
alert(elm.length); // 2
}
window.onload = init;
</script>
</head>
<body>
<form name="shipping" action="">
<input type="hidden" name="cost" value="10">
</form>
<div id="shipping"> </div>
</body>
</html>