Questions on iframr, and on textarea scrolling

Discussion in 'Javascript' started by Dr J R Stockton, Oct 8, 2009.

  1. I'm using an iframe, to load same-domain pages.

    Can JavaScript tell if the requested page does not exist, and if so how?
    I want to note and continue.

    Can JavaScript tell when the page loading is complete, and if so how?
    The equivalent of body onload would do, though after the completion of
    the page's own body onload would be better. For this purpose, it is
    highly desirable that nothing should need to be added to the iframe
    pages.

    Essentially I want
    onCompletelyDoneTheFollowingLine = functionname
    iframe.src = URL
    }

    I have a suspicion that if in at least one browser a "full" page
    is loaded in an iframe, followed by a page with less than two
    anchors, the second page may not replace the anchors array of
    the first page.

    Can JavaScript scroll a textarea, and if so how? I have a textarea that
    gets new lines appended at a variable rate of about one a second, and
    would like to have the newest ones normally visible - just like MSDOS or
    an ASR33.

    --
    (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 7.
    Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
    I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
    free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> unsupported.
     
    Dr J R Stockton, Oct 8, 2009
    #1
    1. Advertising

  2. Dr J R Stockton

    Evertjan. Guest

    Dr J R Stockton wrote on 08 okt 2009 in comp.lang.javascript:

    > I'm using an iframe, to load same-domain pages.
    >
    > Can JavaScript tell if the requested page does not exist, and if so how?
    > I want to note and continue.


    <script type='text/javascript'>
    function isFound(){
    return (window.frames[0].location.href)
    ? 'found' : 'not found';
    };
    </script>

    <iframe src='myTest.html'
    onload='alert(isFound())'
    ></iframe>


    Chrome tested working,
    but I don't think IE will like that code.

    [Using serverside javascript, it is easy.]

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Oct 8, 2009
    #2
    1. Advertising

  3. Questions on iframe, and on textarea scrolling

    In comp.lang.javascript message <Xns9C9EF103E4E1Eeejj99@194.109.133.242>
    , Thu, 8 Oct 2009 21:41:35, Evertjan. <>
    posted:
    >Dr J R Stockton wrote on 08 okt 2009 in comp.lang.javascript:
    >
    >> I'm using an iframe, to load same-domain pages.
    >>
    >> Can JavaScript tell if the requested page does not exist, and if so how?
    >> I want to note and continue.

    >
    ><script type='text/javascript'>
    >function isFound(){
    > return (window.frames[0].location.href)
    > ? 'found' : 'not found';
    >};
    ></script>
    >
    ><iframe src='myTest.html'
    >onload='alert(isFound())'
    >></iframe>

    >
    >Chrome tested working,
    >but I don't think IE will like that code.



    In at least one browser, that event fires on loading of the page outside
    the frame, which is at that stage empty. So I changed to executing

    Fram = document.getElementById("IF") // The iframe

    while the outer page is loading (already there, for another reason), and

    Fram.onload = ReadFram // A function to read the frame contents

    on pressing the "Starting Gun" button.

    In Opera (which is where everything else on the page works best) that
    event clearly fires at the right time. Previously I used a compromise
    300 ms timeout, and a small number of pages were not fully loaded by
    then. Now the whole process is much faster (i.e. well under 300 ms
    needed on average) but all pages are loaded completely.

    Since it is clear that, if timeout is used, it needs to be well over
    zero milliseconds, I have arranged to use timeout if non-zero and onload
    if not, which allows for Firefox & Safari where onload is not (yet?)
    working in the same manner.

    I've not got isFound to actually detect anything yet. But there's
    always the work-round of loading a missing page to get a sample "404"
    for the current system, then looking for a match to it later.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
    Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
    Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
    Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
     
    Dr J R Stockton, Oct 9, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yang Li Ke

    textarea scrolling

    Yang Li Ke, Mar 6, 2004, in forum: Javascript
    Replies:
    0
    Views:
    96
    Yang Li Ke
    Mar 6, 2004
  2. stuart

    Scrolling Multiple Textarea in sync

    stuart, Jul 14, 2004, in forum: Javascript
    Replies:
    6
    Views:
    132
    Stuart Cochrane
    Jul 22, 2004
  3. Scrolling textarea in Opera

    , Dec 22, 2005, in forum: Javascript
    Replies:
    5
    Views:
    145
  4. Keith Bentrup

    scrolling in textarea to selection in FF

    Keith Bentrup, May 31, 2006, in forum: Javascript
    Replies:
    4
    Views:
    155
    Csaba Gabor
    Jun 2, 2006
  5. simonbc

    Scrolling textarea with JS in Safari

    simonbc, May 7, 2007, in forum: Javascript
    Replies:
    0
    Views:
    174
    simonbc
    May 7, 2007
Loading...

Share This Page