js控制文本框只读

<HTML>
<SCRIPT LANGUAGE="JavaScript">

    function isreadonly(isReadOnly){
        document.forms[0].elements['sss'].readOnly =isReadOnly;
    }
    
</SCRIPT>


<BODY>
<FORM METHOD=POST ACTION="">
<INPUT TYPE="text" NAME="sss">
<INPUT TYPE="button" name="zhidu" value="只读" onclick="isreadonly(true)">
<INPUT TYPE="button" name="edit" value="可编辑" onclick="isreadonly(false)">
</FORM>
</BODY>
</HTML>

你可能感兴趣的:(文本框)