Sharalynn
asked on
Enable button after some seconds
I need a button disabled, then wait some time (either random seconds or say, 5 seconds), before it changes text to "You may now proceed" and enable the button. Is it doable with OnClientClick or some sort?
If you use AJAX you can add a timer to your asp.net project.
string script = @"<script language ='javascript'>
document.getElementById('b tnNext').d isabled = 1;
window.setTimeout('enable( )', 3000)
function enable()
{
document.getElementById('b tnNext').d isabled = 0;
}
</script>";
Page.RegisterStartupScript Block("cli ck", script);
http://forums.asp.net/p/914726/1034336.aspx
document.getElementById('b
window.setTimeout('enable(
function enable()
{
document.getElementById('b
}
</script>";
Page.RegisterStartupScript
http://forums.asp.net/p/914726/1034336.aspx
ASKER
Not AJAX website.
Old code from asp.net
Too advanced :(
Old code from asp.net
Too advanced :(
>> Too advanced :(
I had the feeling but after install the ajax and ajax toolkit I found very easy to handle. Is just some extra control that will improve your pages.
I had the feeling but after install the ajax and ajax toolkit I found very easy to handle. Is just some extra control that will improve your pages.
ASKER
But I don't want to implement ajax at all. There must be some other way of doing so easily
Someone already posted the solution for you. it just needed a little modifying.
<script language ='javascript'>
function disable(){
document.getElementById('btnNext').disabled = 1;
window.setTimeout('enable()', 3000)
}
function enable(){
document.getElementById('btnNext').disabled = 0;
}
</script>
<input type="button" id="btnNext" onClick="javascript:disable()" value="Clickme">
ASKER
Thanks mixart, how would I do it for page load instead of button click?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.