A
anonieko
Scenario: You have a page that is TOO slow to refresh.
But it allows partial flushing of html contents. I.e.
Submit button already appears but you don't
want your users to click on it prematurely
because other parts are still coming.
Here I put a javascript the will enable only
submit button only after 5 seconds after the page
is load fully.
The prevention of button being clicked twice
is also done .
<html>
<head>
</head>
<body>
<form id="testForm" >
<input id="test" type=text>
<input type=button value="1click only" onclick="dosubmit()">
</form>
<script type="text/javascript">
<!--
var submitted = false;
var timer1=setTimeout('EnableClick()', 5000);
function EnableClick() {
if (typeof submitted == 'undefined') return false;
submitted = false;
}
function dosubmit(method) {
// prevent clicking twice
if (typeof submitted == 'undefined') return false;
if ( submitted ) return false;
submitted = true;
clearTimeout(timer1);
document.testForm.submit();
}
-->
</script>
</body
But it allows partial flushing of html contents. I.e.
Submit button already appears but you don't
want your users to click on it prematurely
because other parts are still coming.
Here I put a javascript the will enable only
submit button only after 5 seconds after the page
is load fully.
The prevention of button being clicked twice
is also done .
<html>
<head>
</head>
<body>
<form id="testForm" >
<input id="test" type=text>
<input type=button value="1click only" onclick="dosubmit()">
</form>
<script type="text/javascript">
<!--
var submitted = false;
var timer1=setTimeout('EnableClick()', 5000);
function EnableClick() {
if (typeof submitted == 'undefined') return false;
submitted = false;
}
function dosubmit(method) {
// prevent clicking twice
if (typeof submitted == 'undefined') return false;
if ( submitted ) return false;
submitted = true;
clearTimeout(timer1);
document.testForm.submit();
}
-->
</script>
</body