复制代码代码如下 :
<html>
<헤드>
<title> 새로운 문서 </title>
<meta name = "generator"content = "editplus">
<meta name = "author"content = "">
<meta name = "keywords"content = "">
<meta name = "description"content = "">
</head>
<script language = "javaScript">
기능 isreadonly () {
var obj = document.getElementById ( "사용자 이름");
obj.setattribute ( "Readonly", true);
obj.style.backgroundcolor = "#d2d2d2";
}
함수 readWrite () {
var obj = document.getElementById ( "사용자 이름");
obj.setattribute ( "Readonly", false);
obj.style.backgroundcolor = "#ffffff";
}
</스크립트>
<body>
<form name = "addform"id = "addform"method = "post"action = "">
<input type = "text"id = "username"name = "username">
<입력 유형 = "버튼"이름 = "只读"value = "read"onclick = "isreadonly ();">
<입력 유형 = "버튼"이름 = "可写"value = "쓰기"onclick = "readWrite ();">
</form>
</body>
</html>
<!-
点击“읽기”””, 입력 框不能书写, 且变灰;点击“쓰기”按钮, 입력 框恢复。
->