English 中文(简体)
带有原型库的Google Chrome中出错:无法将属性innerHTML设置为null
原标题:Error in Google Chrome with Prototype Library: Cannot set property innerHTML of null

我在应用程序中使用原型库主要是因为它的“跨浏览器”功能。我担心在Firefox中一切都会正常工作,但在IE上崩溃了。但令我惊讶的是,谷歌Chrome上的这行代码崩溃了(而且以一种非常恶心的方式):

   $( mensajes ).update("");

带有消息:<code>类型错误:无法将属性innerHTML设置为null</code>

mensajes存在,并且此代码在Firefox和Internet Explorer中完美工作

有线索吗?

PS:我发现hide()也会出现问题,我怀疑其他方法也可能有问题。

Chrome是bug还是原型?

问题回答

只需使用innerHTML

$( mensajes ).innerHTML =   ;

由于所有开销(检查要运行的脚本等),我只在极少数情况下使用.update()

Post I did about this a while back http://practical-prototype.blogspot.com/2008/03/when-to-use-prototypes-features-and.html





相关问题
Redirect to cache URL in Chrome browser

self.location = cache: + self.location I want to redirect from "[URL]" to "cache:[URL]". I just want this code to work in Chrome browser.

我如何更新/重载 Chrome延?

I m在4号 Chrome(目前为4.0.249.0)中开发一个延伸点,显示用户在地位酒吧中的形象。 Ive设计了一个供用户使用的备选办法网页......

Setting Opacity in CSS For Chrome

I ve tried the following: (this is actually for fancybox, as the overlay does not show in chrome/safari: $("#fancy_overlay").css({<br /> background-color : opts....

Chrome Blocking Javascript, Google Wave, Google Gadgets

Project: Developing a gadget template for Google Wave which will allow my Flash movies to interact with the Wave api. I had to adapt the existing Flex application so that it would work with ...

image height using jquery in chrome problem

$( img ).height() returns 0 in chrome, but it returns the actual height in IE and firefox. Whats the actual method to get the height of the image in chrome?

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Table cells bad rendering with Google Chrome/Webkit

On the following code, COL1A and COL3A are not 50% height with Chrome or Webkit. It works fine with IE7 and Firefox. <table border="1"> <tr> <td height="100%">COL 1A</td>...

热门标签