只要复制以下代码,运行OK.
可以对任何表单对象都起作用。<%@page language="java" contentType="text/html;charset=GBK"%>
<%
 String rd="v";%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>只读例子</title>
</head><body>
<form name="form1" method="post" action="">
   
   <input type="text" name="textfield" <%if ("y".equals(rd)) {%> readonly<%}%>    >
   
</form>
</body>
</html>