Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Questions on iframr, and on textarea scrolling

Reply
Thread Tools

Questions on iframr, and on textarea scrolling

 
 
Dr J R Stockton
Guest
Posts: n/a
 
      10-08-2009
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.
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-08-2009
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)
 
Reply With Quote
 
 
 
 
Dr J R Stockton
Guest
Posts: n/a
 
      10-09-2009
In comp.lang.javascript message <Xns9C9EF103E4E1Eeejj99@194.109.133.242>
, Thu, 8 Oct 2009 21:41:35, Evertjan. <(E-Mail Removed)>
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
smooth scrolling & auto scrolling sillyputty Firefox 1 08-24-2007 02:10 AM
scrolling in textarea to selection in FF Keith Bentrup Javascript 4 06-02-2006 07:36 AM
Scrolling textarea in Opera bwucke@gmail.com Javascript 5 12-23-2005 08:23 AM
Scrolling Multiple Textarea in sync stuart Javascript 6 07-22-2004 11:05 AM
textarea scrolling Yang Li Ke Javascript 0 03-06-2004 01:00 AM



Advertisments