Error in Google Chrome with Prototype Library: Cannot set property innerHTML of null
I used the Prototype library in an app mostly because its "cross-browsers" features. My fear was that ever开发者_开发问答ything would work fine in Firefox but crashed on IE. But for my surprise, this line of code crash (and in a very disgusting way) on Google Chrome:
$('mensajes').update("");
With the message: TypeError: Cannot set property 'innerHTML' of null
'mensajes' exist, and this code works perfectly in Firefox and Internet Explorer
Any clue?
PS: I discovered that also problems happens with hide(), and I suspect that other methods may be problematic too.
Is Chrome the buggier, or Prototype?
Just use innerHTML
$('mensajes').innerHTML = '';
I only use .update() in rare cases because of all the overhead (checking for scripts to run etc)
Post I did about this a while back http://practical-prototype.blogspot.com/2008/03/when-to-use-prototypes-features-and.html
精彩评论