<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>註冊</title>
<link href="css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var lefttime = 10;
function signIn() {
document.getElementById("btn").value = "";
if (lefttime == 0) {
document.getElementById("btn").disabled = false;
document.getElementById("btn").value ="閱讀完畢"
return false;
}
else {
document.getElementById("btn").value += "請仔細閱讀條款,還剩" + lefttime + "秒";
lefttime--;
}
setTimeout("signIn()", 1000);
}javascript
</script>
</head>
<body onload="signIn()">
<form id="form1" runat="server">
<div class="a1">
<input type="button" id="btn" onclick="alert('您已閱讀完畢')" disabled="disabled" />
</div>
</form>
</body>
</html>css
disabled 屬性規定應該禁用 input 元素。html
被禁用的 input 元素既不可用,也不可點擊。能夠設置 disabled 屬性,直到知足某些其餘的條件爲止(好比選擇了一個複選框等等)。而後,就須要經過 JavaScript 來刪除 disabled 值,將 input 元素的值切換爲可用。java