treehouse : what would you like to learn today?
Web Design Web Development iOS Development

JavaScript Gurus: Help with ScrollIntoView with NS/Moz vs. I

  • I'm working on a nice spellchecker for vB, posted at vb.org

    Within the spellcheck window, it uses an IFRAME, and I would like the window to scroll the contents to the highlighted word elemented (named hl).

    The following line:

    parent.ispellcheck.document.getElementById("h1").s crollIntoView(false);

    Works fine in IE, but doesn't do much with Netscape/Mozilla/Firefox.

    Anyone knows the proper syntax to get scrollIntoView to work properly?

    I've tried several variatons in the (else) part below, to no avail:


    hilightWord();
    if (ie) {
    parent.spellbox.document.getElementById("h1").scrollIntoView(false); //works for IE only !!!?!??!
    }
    else
    {
    //parent.spellbox.document.getElementById("h1").scrollIntoView(false); // does not work
    document.spellbox.getElementById("hl").scrollIntoView(false);
    // does not work!!!
    }

    You can see the entire source, if it helps. I'm just hoping it's an easy to spot problem for those familiar with how the different browsers want to call IFRAMEs.

















    -----------------------
    lortie