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