想让表单显示又不想让修改.这方法挺适用.简单明了.一句disabled="disabled"就禁用了.还想打开就又得JS了.
下面是代码:IE6,7,8,FF都测试了.没什么题.
<!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>
<title>js表单禁用质恢及激活方法-布丁足迹ddhbb.com</title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
function $(id) {return document.getElementById(id)}
function editInput(tag) {
obj = $(tag);
if(!obj) return false;
obj.style.backgroundColor = "#c4c4c4";
$('bt').onclick=function() {
obj.disabled = false;
obj.style.backgroundColor = "#fff";
}
}
</script>
</head>
<body onload="editInput('test')">
<input type="text" value="布丁足迹ddhbb.com" disabled="disabled" id="test">
<input id="bt" type="button" value="修改">
</body>
</html>