Don't know what your experience is but I've been bit by "onload" handlers
many times.  I do NOT trust that they wait for the page to be completely
loaded.  The only thing I've done that works consistently is to set my OWN
"Page done" flag AFTER the closing <HTML> tag.

-----Original Message-----
From: Marlon Moyer [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 2:09 PM
To: CF-Talk
Subject: Re: Making _javascript_ Wait.

I would do something like this <body >
and have this script at the top

<script>

var links_enabled = false;

function enableLinks() {
links_enabled = true;
}
function Popup(file,width,height)
{

var topX = (screen.width - width)/2;
var topY = (screen.height - height)/2;

if (links_enabled) {
popup = window.open(file, "Popup", "fullscreen=no, toolbar=no,
status=no, menubar=no, scrollbars=yes, resizable=yes, directories=no,
location=no, width="+width+", height="+height+", left="+topX+", top="+topY)
popup.focus();
}
return false;
}
<script>

Jim Davis wrote:

> There are several things to do.
>
>
> The easiest, I think, is to move all your script the top of the page -
> then
> you know it's loaded.
>
>
> If you can't do that you could set a variable at the top of the page
> ""Loading" to "true", then at the very bottom of the page say "Loading =
> false".
>
>
> All of your links could then run a function (loaded at the top) to
> determine
> if the page is still loading - if it is you could wait, looping on a short
> interval until it is (I would), or throw a message saying "please
> wait" (not
> as elegant I think).
>
>
> Jim Davis
>
>
>   _____
>
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 10:15 AM
> To: CF-Talk
> Subject: RE: Making _javascript_ Wait.
>
>
> I was hoping for something a little more intuitive then just making the
> script wait one, or two or three, seconds every time.  Because, often it
> doesn't need to wait.  This only is a problem if the user clicks a detail
> screen while the page is still rendering.  Once the page is done, they can
> click links all they want, why make them wait then, when it is
> unnecessary.
> Also, what if the page is really slow do to network traffic or other
> factors
> beyond my control, at it takes more then the allotted wait time to
> render, I
> could occasionally still get the error.
>
> What I think might be best, is to check for the existence of the "required
> object", if unavailable, then don't allow the function to run, until it is
> available.  I just not skilled enough in my JS to figure out what
> object to
> which the error is referring.  Anybody give some insight into this?
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> -----Original Message-----
> From: Justin Hansen [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 6:57 AM
> To: CF-Talk
> Subject: RE: Making _javascript_ Wait.
>
> to js wait.... setTimeout("functionCall()",1000);
>
> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 8:47 AM
> To: CF-Talk
> Subject: OT: Making _javascript_ Wait.
>
> I have a page that has upwards of 200 links on it that each will open a
> detail screen in a new window with a _javascript_ function.  This is a
> calendar display showing all the events in a month with the ability to get
> further details in a popup window by clicking on the event's name.
>
> The problem, is that apparently the _javascript_ throws an "object expected"
> error, if a link is clicked before the entire calendar page is
> rendered.  It
> is large enough, the this can take a full second or three to complete.
>
> Is it possible to prevent this error?  A better way to implement the
> code so
> that it doesn't matter if the main window if fully rendered? Something to
> cause the function to gracefully fail (no error message displayed) or not
> run or wait if it's not ready to run correctly?  Something else?
>
> Thanks for any help.
>
> function Popup(file,width,height)
> {
>
> var topX = (screen.width - width)/2;
> var topY = (screen.height - height)/2;
>
> popup = window.open(file, "Popup", "fullscreen=no, toolbar=no,
> status=no, menubar=no, scrollbars=yes, resizable=yes, directories=no,
> location=no, width="+width+", height="+height+", left="+topX+",
> top="+topY)
> popup.focus();
>
> return false;
> }
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>   _____
>    _____
>   _____
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to