Grow your CSS skills. Land your dream job.

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

  • # September 27, 2009 at 6:16 am

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".