[Javascript] A Temporary Alert?

David Lovering dlovering at gazos.com
Tue Dec 25 21:49:13 CST 2007


I agree - you may recall I said the solution I proposed was 'dirty'. 
Irrespective of what you use, some layer management would be a good idea - 
all together too many apps park messages off the screen or behind some other 
element, or rely on some absurd window geometry that doesn't apply.

-- Dave Lovering

----- Original Message ----- 
From: "Peter Brunone" <peter at brunone.com>
To: <javascript at lists.evolt.org>
Sent: Sunday, December 23, 2007 7:48 PM
Subject: Re: [Javascript] A Temporary Alert?


Wouldn't it be better to use an element as a layer over the rest of the 
content, rather than a child window that could be blurred and stuck behind 
the main window?

Just a thought...

Peter

From: "David Lovering" dlovering at gazos.com

This is hardly the most elegant solution, but it works on most browser
platforms I've dealt with.

In the HTML body declaration of your dialog, create an 'onload' event
handler of the following sort:

onload = "setTimeout( 'window.this.close()', 5000)";

This is dirt simple, and no doubt will call down the wrath of the Javascript
gurus with much more refined (and less fragile) solutions.

While you can reference an alert as a window and play the same games, it is
often hard (and somewhat browser dependent) to do so; I prefer to create a
child window and use it instead of a generic alert. With a little
imagination, you can manipulate the window parameters so that the user is
completely unaware that he is not talking directly to an alert - but you
have the window id and name under your full control. It also is less
complicated to reference the portion of the code in order to insert
the onload handler.

-- Dave Lovering

----- Original Message ----- 
From: "tedd"
To: "JavaScript List"
Sent: Saturday, December 22, 2007 3:33 PM
Subject: [Javascript] A Temporary Alert?

> Hi gang:
>
> I've looked, but can not find a temporary Alert.
>
> What I mean is:
>
> "Hi, this is a temporary Alert box and I will automatically close in
> 5 seconds."
>
> An Alert that will notify the user of something, but will NOT require
> the user to respond to go away. But instead, will close on its own
> after a set time.
>
> It sounds simple enough, but I couldn't find nor generate one. Can
> this be done?
>
> Thanks in advance for any references or code.
>
> Cheers,
>
> tedd



--------------------------------------------------------------------------------


> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript 





More information about the Javascript mailing list