先上代码:
<html>
<head>
<title> test </title>
<meta charset="utf-8">
</head>
<script language="JavaScript">
function setReadonly() {
//document.getElementById("test").setAttribute("readOnly", true);
document.getElementById("test").readOnly=true;
}
function readWrite() {
//document.getElementById("test").setAttribute("readOnly", false);
document.getElementById("test").readOnly=false;
}
</script>
<body>
<form name="addform" id="addform" method="post" action="">
<input type="text" id="test" >
<input type="button" value="只读" οnclick="setReadonly();">
<input type="button" value="读写" οnclick="readWrite();">
</form>
</body>
</html><html>
<hea