Thursday, February 28, 2008

Some tricks when using Prototype on IE

I have faced several problems when I am working using Prototype on IE. My friends and I also have found solutions already. But these problems don't exist on FF. These problems occur when using DOM method "document.createElement()" with prototype.

1. You cannot use variable that returns from "document.createElement()" with some methods like: setStyle, getDimensions(),....
To solve it, using this trick: var div = $(document.createElement("div"));

2. In order to set position of that variable, you need to append this to the browser first like document.getElementsByTagName("body").item(0).appendChild(div);

3. In order to access it and use it without problems, you need to use this trick too, $(, ..... Use this after you append to the browser already.

No comments:

Subscribe in a Reader