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

A

Andrew Phillipo

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.
 
M

Martin Honnen

Andrew said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top