Close alert

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
 
G

Guest

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
 
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 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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top