469,632 Members | 1,750 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

innerHTML, IE5.0, Error 'Line: 0 Error: Object required

I have some code that works everywhere but IE5.0, including IE5.5.
Here is a snippet of where the code seems to go wrong:

Location.prototype.change = function(current) {
this.current = current; // refers to the currently selected estate
agent
var elem = dhtml_get_element(this.id()); // cross browser
getElementById
var oldElem = elem.parentNode; // we can't replace tables using
innerHTML - get the parent element (a div)
oldElem.innerHTML = this.html(); // set the innerHTML
return false;
};

This function is executed when an estate agent is selected under a
property (onclick) - it replaces one of the blocks of code with the
output of this.html().

This works in every browser, even in IE5.0 the content changes. However
in 5.0 before the content changes I get a javascript error:

---------------------------
Error
---------------------------
A Runtime Error has occurred.
Do you wish to Debug?

Line: 0
Error: Object required
---------------------------
Yes No
---------------------------

This error NEVER goes away and keeps reappearing whatever is clicked.

Debugging does not give me anymore information; instead saying that it
cannot debug inside an anonymous function ... which I don't think is
being used.

What I think is happening is that IE internally refers somewhere to the
elements created on the page and replacing them causes it it to throw a
wobbly.

I have also tried creating a new element and setting the innerHTML on
that, then using replaceChild to change the document, but to no avail.

Hopefully someone can help me before I turn to self harm!

Thanks a LOT guys.

Sep 27 '05 #1
1 3962


Andrew Phillipo wrote:
I have some code that works everywhere but IE5.0, including IE5.5. Location.prototype.change = function(current) { Debugging does not give me anymore information; instead saying that it
cannot debug inside an anonymous function ... which I don't think is
being used.


On the right hand side of your above assigment you have an anonymous
function.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 27 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Nick | last post: by
16 posts views Thread by Joel Byrd | last post: by
9 posts views Thread by Hallvard B Furuseth | last post: by
1 post views Thread by huzheng001 | last post: by
2 posts views Thread by m0nkeymafia | last post: by
5 posts views Thread by noddy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.