[Javascript] Re: Javascript Digest, Vol 5, Issue 10

Bob and Sharon Hiller rhiller at shianet.org
Tue Jul 15 19:24:23 CDT 2003


I found this script on the web:
Like this:

<script language="JavaScript"
  id=SomeFile src="somefile.js"></script>
<script language="JavaScript">

function useStuffInSomeFile() {
}

if (SomeFile.readyState == "complete" ) {
   useStuffInSomeFile();
} else {
   SomeFile.onreadystatechange = ifComplete();
}

function ifComplete() {
   if (SomeFile.readyState == "complete") {
        SomeFile.onreadystatechange = null;
        useStuffInSomeFile();
  }
}
</script>


However, onreadystatechange is undefined.
Is there a different command I can use? or perhaps I am not using the
correct syntac?

Thanks for your help, this problem is driving me crazy!!!!

Sharon

----- Original Message -----
From: <javascript-request at LaTech.edu>
To: <javascript at LaTech.edu>
Sent: Sunday, July 13, 2003 1:00 PM
Subject: Javascript Digest, Vol 5, Issue 10


> Send Javascript mailing list submissions to
> javascript at LaTech.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.LaTech.edu/mailman/listinfo/javascript
> or, via email, send a message with subject or body 'help' to
> javascript-request at LaTech.edu
>
> You can reach the person managing the list at
> javascript-owner at LaTech.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Javascript digest..."
>
>
> Today's Topics:
>
>    1. Re: downloading javascript (Laurent Goffin)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 13 Jul 2003 11:22:51 +0200
> From: "Laurent Goffin" <lgoffin at wonderweb.net>
> Subject: Re: [Javascript] downloading javascript
> To: "[JavaScript List]" <javascript at LaTech.edu>
> Message-ID: <012401c34920$56fa4810$0202a8c0 at emakina.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> >3. Could the html be so small that the javascript does not have time to
download?  The javascript is 9kb.
> >4. How is a page loaded?  ie starts with the html and as soon as external
import is found, downloads the javascript?  when the end html is found does
all downloads stop?
>
> Right,
>
> there are chances that ur javascript is not yet loaded when the HTML page
call for the functions...
> I dont mean not yet downloaded but when the HTML page is loading, the
browser interpret HTML and create a DOM out of this. In the mean time, he is
downloading the JS external file and when the file is dlowloaded or present
in the cache, the browser is interpreting all functions in order to make
them available by the page.
>
> For instance, when the BODY of your page is calling on onload event a
function in ur external JS, it's possible the JS is already downloaded but
the function does not exist yet for the browser.
>
> It's the same too when a JS function try to call an HTML object while the
page is not fully loaded yet (check onreadystate event for this)
>
> A solution to this : when u call the first function and this function does
not exist yet, just call instead a function which is a timeout checking if
the other function exist. When the function exist, just call it and stop
timeout.
>
> Thsi require of course the timeout function to be outside of the JS
file...
>
> Have a nice day
>
> L. Goffin
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
http://lists.LaTech.edu/pipermail/javascript/attachments/20030713/3b2bb0b6/a
ttachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> End of Javascript Digest, Vol 5, Issue 10
> *****************************************
>




More information about the Javascript mailing list