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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Phillipo

    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.protot ype.change = function(curren t) {
    this.current = current; // refers to the currently selected estate
    agent
    var elem = dhtml_get_eleme nt(this.id()); // cross browser
    getElementById
    var oldElem = elem.parentNode ; // we can't replace tables using
    innerHTML - get the parent element (a div)
    oldElem.innerHT ML = 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.

  • Martin Honnen

    #2
    Re: innerHTML, IE5.0, Error 'Line: 0 Error: Object required



    Andrew Phillipo wrote:
    [color=blue]
    > I have some code that works everywhere but IE5.0, including IE5.5.[/color]
    [color=blue]
    > Location.protot ype.change = function(curren t) {[/color]
    [color=blue]
    > 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.[/color]

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


    --

    Martin Honnen

    Comment

    Working...