Close alert

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

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 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
 
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
 
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/AjaxControlToolkit/Samples/PopupControl/PopupControl.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
 
Back
Top