Sunday, December 11, 2005

Disabling a button for few seconds

I have founded today in my backups the following code:

<script type="text/javascript">
<!--
var secs = 20;
var wait = secs * 1000;
document.sform.submitbtn.disabled=true;

for(i=1;i<=secs;i++)
{
window.setTimeout("update(" + i + ")", i * 1000);
}

window.setTimeout("timer()", wait);

function update(num)
{
if(num == (wait/1000))
{
document.sform.submitbtn.value = "Akzeptieren";
}
else
{
printnr = (wait/1000)-num;
document.sform.submitbtn.value = "Akzeptieren (" + printnr + ")";
}
}

function timer() {
document.sform.submitbtn.disabled=false;
}
//-->
</script>

I don't have written the above code by myself... Anyway
thanks to the writer. Just tested it and its working very
good, in case you want that user reads a your lic. agreement
or anything else.

No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge