开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜