The simple act of sourcing jquery seems to be preventing my double
click prevention function from working in at least Firefox 3.0.7. Any
ideas why jquery would prevent my click_check() from executing
normally?
<html>
<head><title>jquery double click test</title>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var click_count = 0;
var reset_timeout = 3;
var reset_counter = reset_timeout;
var reset_counter_started = false;
function reset_click_count()
{
reset_counter_started = true;
reset_counter -= 1;
if (reset_counter <= 0) {
click_count = 0;
reset_counter = reset_timeout;
reset_counter_started = false;
} else {
setTimeout('reset_click_count()', 1000);
}
}
function click_check()
{
if (click_count == 0) {
click_count++;
reset_counter = reset_timeout;
if (reset_counter_started == false)
setTimeout('reset_click_count()', 1000);
return true;
} else {
return false;
}
}
</script>
</head>
<body>
<form action="result.html" method="post" onsubmit="return click_check
()">
<input type="text" name="test" value="1">
<input type="submit" name="mysubmit" value="Submit">
</form>
</body>
</html>