Asp.Net常用js(六)
时间:2010-09-01 来源:无意创新
注册需要等待10秒
代码
<input name="rulesubmit" id="agree" class="button" type="submit" value="我已阅读并同意以上条款"> <input type="button" name="return" class="button" value="不同意" onclick="javascript:window.location='/opencms/index.html';"></div>
</form>
<script language="javascript">
var secs = 10;
var wait = secs * 1000;
document.bbrules.rulesubmit.value = "我已阅读并同意以上条款 (" + secs + ")";
document.bbrules.rulesubmit.disabled = true;
for(i = 1; i <= secs; i++) {
window.setTimeout("update(" + i + ")", i * 1000);
}
window.setTimeout("timerrun()", wait);
function update(num, value) {
if(num == (wait/1000)) {
document.bbrules.rulesubmit.value = "我已阅读并同意以上条款";
} else {
printnr = (wait / 1000)-num;
document.bbrules.rulesubmit.value = "我已阅读并同意以上条款 (" + printnr + ")";
}
}
function timerrun() {
document.bbrules.rulesubmit.disabled = false;
document.bbrules.rulesubmit.value = "我已阅读并同意以上条款";
}
</script>
关于浏览器关闭的捕捉事件
代码
<script language=javascript>
window.onbeforeunload = function()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "";
//your code
}
}
</script>
相关阅读 更多 +