I don't think the error is in the posted code; both versions work for me and neither of those calls do anything much different on the different browsers.
However Prototype does work very differently in IE and Mozilla, and this may be causing differences elsewhere in your code.
In Mozilla, Prototypre adds its methods to the prototypes of HTMLElement et al, so that all DOM objects can have these methods called on them directly. However this is not possible in IE(*), so to cover all browsers you have to ‘augment’ each node you want to call methods on, either explicitly by calling Element.extend
on it, or implicitly by using one of Prototype's own methods, such as the $
function, to get a handle on the object:
document.getElementByID('foo').hide(); // ok on Mozilla, fail on IE
$('foo').hide(); // ok everywhere
Element.hide('foo'); // ok everywhere
Element.extend(document.getElementByID('foo'));
document.getElementByID('foo').hide(); // ok everywhere
This is actually one of Prototype's worst features, because you can write a load of code in Mozilla that will fail in IE and not notice: it's not so much hiding the browser differences as amplifying them.
What's worse, since many of Prototype's own methods extend objects implicitly, and because once extended those Nodes retain their extensions, it is very easy to get situations where in IE your code that forgets to extend an element will usually work because something else extended it already, but in some rarer circumstance will blow up. This ain't good for debugging.
(*: not IE's fault. In the ECMAScript standard there is no expectation that you'll be able to alter the prototypes of ‘host objects’ like the DOM, even if you can get a handle on their constructor function, which is also not specified to exist in any particular place. Prototype is taking advantage of a non-standard feature to make code potentially look nicer, but you can't take advantage of that in practice, sadly.)