开发者

IE8 whines about Prototype, "'undefined' is null or not an object"

开发者 https://www.devze.com 2022-12-08 08:27 出处:网络
I have an element that is dynamically created with new Element(\'div\') and is then faded in, moved, and faded out. In every browser, my code works as expected – every browser but IE.

I have an element that is dynamically created with new Element('div') and is then faded in, moved, and faded out. In every browser, my code works as expected – every browser but IE.

Internet Explorer complains that 'undefine开发者_运维百科d' is null or not an object exactly as documented on Prototype's Lighthouse.

To get the error, I write, new Message('Your contact information has been saved');

The source for my Message class is available at this gist.


“Undefined is null of not an object” is a very basic error message that can be produced in a huge range of situations (it's JScript's effective equivalent of a null pointer exception). So it's unlikely yours is the same error as mentioned above.

I don't get that error though. I get “Invalid argument”, which seems to be caused by:

new Effect.Move(_div, {sync: true, x: '50%', y: 35, mode: 'relative' })

If I change the % to a normal integer pixel value it works fine. x is documented as accepting only an integer value not a CSS measurement; the '%' doesn't work for me in other browsers either (acts as 0). I guess you've made this feature up!

As Fabien mentioned, you also need to insert some var statements, otherwise you're scribbling over the globals and Message will blow up if you try to create two of them. Plus take care not to leave a trailing , in an array literal (due to the commented line), as this confuses IE.

0

精彩评论

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