控制input框只读可以防止用户对数据的更改,在某些情况下还是比较实用的,下面使用js来完成这个只读实现
<title> New Document </title>
<meta>
<meta content="">
<meta>
<meta name="Description">
<script language="JavaScript">
function isreadonly(){
var obj =
document.getElementById("username");
obj.setAttribute("readOnly",true);
obj.style.backgroundColor="#d2d2d2";
}
function readwrite(){
var
obj = document.getElementById("username");
obj.setAttribute("readOnly",false);
obj.style.backgroundColor="#ffffff";
}
</script>
以上就是js设置input文本框只读的详细内容,更多请关注php中文网其它相关文章!
相关文章:











