« July 2007 | Main | October 2007 »

September 24, 2007

IE7 Prototype.js and Scriptaculous Error

So what exactly does "the object does not support this property" mean anyway?

I was doing some development for a new website and I wanted to do something a little special on the user profile page. This required me to use some AJAX to add user defined links to the profile page. I wanted the user to be able to add, delete and edit the links using a single set of controls and when a link was added, i needed the javascript to add the new link into the page HTML (along with newly created edit control) each time.

I developed the code using firefox since i really love the web development and javascript support that is provided as browser extensions. I also wanted to use prototype.js and scriptaculous.js to handle the AJAX and cool visual effects (i might have gotten a bit carried away).

Anyway, the page worked perfectly under firefox, but it broke in a very strange way under IE. The page worked fine right until i needed to add a newly created link. What was really odd is scriptaculous function calls to toggle control behavior became broken with "the object does not support this property" error. The calls worked fine right before the html was created for the link.

I messed with it for a while and even tried the MS Script debugger (usable but a little clunky) and debugbar (lots of eye candy, but not really usable) but ended up using the old standby: commenting out code and adding alert() calls.

In the end I was able to fix the problem by encapsalating the set of links in a div and then modifying the smaller div that only contained links and image tags. The original div contained the edit form for adding and modifying the link and a bit of javascript (but not much).

At any rate this has fixed the IE problem and now function is the same for both browsers. I'm just letting people know what I ran into to perhaps save somebody hours of poking around. I found very little useful help online.

Posted by Hefe at 07:31 PM | Comments (0)