按钮的禁用与激活

来源:互联网 发布:一橙网络投诉电话 编辑:程序博客网 时间:2024/05/16 15:18

<!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>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<form name="form2" onsubmit="alert('你提交了表单!
/n')">
<input name="s" type="button" disabled="disabled"
id="s" value="一个按钮">
<input name="btn1" type="button" id="btn1"
onclick="s.disabled = !s.disabled" value="交换状态">
<input type="button" onclick="s.disabled=false"
value="激活">
<input type="button" onclick="s.disabled=true"
value="禁用">
<br />
<br />
<input type="submit" name="Submit" value="提交"
onclick="alert(s.disabled)"/>
</form>
</body>
</html>

原创粉丝点击