代码
<!
DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
>
< html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=UTF-8" >
< title > Insert title here </ title >
< script type ="text/javascript" >
function $(id){
return document.getElementById(id);
}
var remain = 10 ;
function init(){
$( " btn " ).innerHTML = " 提交( " + (remain -- ) + " 秒) " ;
if (remain > 0 ){
window.setTimeout(init, 1000 );
}
else {
$( " btn " ).disabled = false ;
$( " btn " ).innerHTML = " 提交 " ;
}
}
</ script >
</ head >
< body onload ="init()" >
< button id ="btn" disabled ="disabled" > 提交 </ button >
</ body >
</ html >
< html >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=UTF-8" >
< title > Insert title here </ title >
< script type ="text/javascript" >
function $(id){
return document.getElementById(id);
}
var remain = 10 ;
function init(){
$( " btn " ).innerHTML = " 提交( " + (remain -- ) + " 秒) " ;
if (remain > 0 ){
window.setTimeout(init, 1000 );
}
else {
$( " btn " ).disabled = false ;
$( " btn " ).innerHTML = " 提交 " ;
}
}
</ script >
</ head >
< body onload ="init()" >
< button id ="btn" disabled ="disabled" > 提交 </ button >
</ body >
</ html >
关于button按钮:
定义和用法
<button> 标签定义一个按钮。
在 button 元素内部,您可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。
<button> 控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。例如,我们可以在按钮中包括一个图像和相关的文本,用它们在按钮中创建一个吸引人的标记图像。
唯一禁止使用的元素是图像映射,因为它对鼠标和键盘敏感的动作会干扰表单按钮的行为。
请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。
重要事项:如果在 HTML 表单中使用 button 元素,不同的浏览器会提交不同的值。Internet Explorer 将提交 <button> 与 <button/> 之间的文本,而其他浏览器将提交 value 属性的内容。请在 HTML 表单中使用 input 元素来创建按钮。