<div class="codetitle"> <span><a style="CURSOR: pointer" data="2090" class="copybut" id="copybut2090" onclick="doCopy('code2090')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code2090"> <br> <br> <br><title> New Document </title> <br><meta name="Generator" content="EditPlus"> <br><meta name="Author" content=""> <br><meta name="Keywords" content=""> <br><meta name="Description" content=""> <br> <br><script language="JavaScript"> <BR>function isreadonly(){ <BR>var obj = document.getElementById("username"); <BR>obj.setAttribute("readOnly",true); <BR>obj.style.backgroundColor="#d2d2d2"; <BR>} <BR>function readwrite(){ <BR>var obj = document.getElementById("username"); <BR>obj.setAttribute("readOnly",false); <BR>obj.style.backgroundColor="#ffffff"; <BR>} <BR></script> <br> <br><form name="addform" id="addform" method="post" action=""> <br><input type="text" id="username" name="username"> <br><input type="button" name="只读" value="read" onclick="isreadonly();"> <br><input type="button" name="可写" value="write" onclick="readwrite();"> <br> </form> <br> <br> <br><!-- <BR>点击“read”按钮,input框不能书写,且变灰;点击“write”按钮,input框恢复。 <BR>--> <br> </div>