JavaScript Element global object.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gilad_Kutiel
Posted On:   Tuesday, March 25, 2008 07:27 PM

Hi



I would like to add functionality to the Element object. Tried to do that as follow:




Element.prototype.move = function(x, y){/*TODO*/}


This works grate with Firefox but doesn't at all with IE



Any solution/suggestion are welcomed.



Thank you


Gilad

Re: JavaScript Element global object.

Posted By:   Stephen_McConnell  
Posted On:   Wednesday, March 26, 2008 09:49 AM

One could be flippant and say switch to Firefox, but I have also run into this problem in the way that Firefox and IE handle the adding of methods to Element. And if you look at some of the source code comments in the JavaScript framework Prototype (by the way looking through their code is a Great way to learn the power of JavaScript and Object Based design in JavaScript ) they ran into this problem, too.


IE seems to object when you try to add that type of method to Element.... Firefox doesn't...


If my memory serves me correctly, in the "Prototype" framework, they have a work-around. I have been using the Prototype Framework when I need to add "methods" to Element or anything like that.... It handles the "browser" differences underneath the covers.


Hope you get this working...


Stephen McConnell

About | Sitemap | Contact