Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Close alert

Reply
Thread Tools

Close alert

 
 
David C
Guest
Posts: n/a
 
      10-07-2009
I have an aspx page with Javascript that shows a message from a hidden
textbox as shown below.

var vmsg = document.getElementById('txtMsg');
if (vmsg.value != '') {
alert(vmsg.value);
document.getElementById('txtMsg').value = '';
}


I would like to have the alert box display for 3 seconds and then close. I
have tried the window.setTimeout with no success. Is there a way to
accomplish this? Thanks.

David


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      10-07-2009
On Oct 7, 6:25*pm, "David C" <(E-Mail Removed)> wrote:
> I have an aspx page with Javascript that shows a message from a hidden
> textbox as shown below.
>
> * * var vmsg = document.getElementById('txtMsg');
> * * if (vmsg.value != '') {
> * * * * alert(vmsg.value);
> * * * * document.getElementById('txtMsg').value = '';
> * * }
>
> I would like to have the alert box display for 3 seconds and then close. *I
> have tried the window.setTimeout with no success. *Is there a way to
> accomplish this? *Thanks.
>
> David


I think, you can't do this with JavaScript. You can do a hidden div
and show it instead of alert function, like in the example below:

http://forums.tizag.com/archive/index.php?t-961.html
 
Reply With Quote
 
 
 
 
David C
Guest
Posts: n/a
 
      10-07-2009

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Oct 7, 6:25 pm, "David C" <(E-Mail Removed)> wrote:
> I have an aspx page with Javascript that shows a message from a hidden
> textbox as shown below.
>
> var vmsg = document.getElementById('txtMsg');
> if (vmsg.value != '') {
> alert(vmsg.value);
> document.getElementById('txtMsg').value = '';
> }
>
> I would like to have the alert box display for 3 seconds and then close. I
> have tried the window.setTimeout with no success. Is there a way to
> accomplish this? Thanks.
>
> David


I think, you can't do this with JavaScript. You can do a hidden div
and show it instead of alert function, like in the example below:

http://forums.tizag.com/archive/index.php?t-961.html

Is there any asp.net solution, e.g. via Ajax popup control or something?
The process I need is on a asp:button click event Thanks.

David


 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      10-07-2009
On Oct 7, 9:17*pm, "David C" <(E-Mail Removed)> wrote:
> "Alexey Smirnov" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Oct 7, 6:25 pm, "David C" <(E-Mail Removed)> wrote:
>
> > I have an aspx page with Javascript that shows a message from a hidden
> > textbox as shown below.

>
> > var vmsg = document.getElementById('txtMsg');
> > if (vmsg.value != '') {
> > alert(vmsg.value);
> > document.getElementById('txtMsg').value = '';
> > }

>
> > I would like to have the alert box display for 3 seconds and then close.. I
> > have tried the window.setTimeout with no success. Is there a way to
> > accomplish this? Thanks.

>
> > David

>
> I think, you can't do this with JavaScript. You can do a hidden div
> and show it instead of alert function, like in the example below:
>
> http://forums.tizag.com/archive/index.php?t-961.html
>
> Is there any asp.net solution, e.g. via Ajax popup control or something?
> The process I need is on a asp:button click event Thanks.
>
> David


You can try PopupControl

http://www.asp.net/AJAX/AjaxControlT...upControl.aspx

But asp:button has OnClientClick method which can be used to call
client scripts:

For example:
<asp:Button ... OnClientClick='setTimeout("hidebox()", 5000);'>

Hope this helps
 
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
How to close a TCP socket? (TCPSocket#close doesn't close it) IƱaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
Alert..General Alert?..New Discovery?. =?Utf-8?B?U3BhbW1lcipLaWxsZXI=?= Wireless Networking 0 07-24-2007 03:36 PM
on click in popup window throws alert : need to avoid alert of postdata Ganesh ASP .Net 0 06-29-2007 06:51 AM
How to create a form Alert - Not using Alert Boxes Mersh Java 0 03-13-2007 04:14 PM
ALERT: Virus Scam Alert! Toronto Garage Door Company Computer Support 1 11-18-2003 04:16 PM



Advertisments