asp 文本字段问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 08:12:14
请各位大侠帮忙:
我有几个文本字段,同时从数据库读取内容,填入在各自的文本字段中,如果有内容的文本字段则不可以修改,没有内容的文本字段可以修改,请问怎么写代码啊?
<td valign="top"><input name="c_name_1" type="text" id="c_name_1" size="20" value="<%=(Recordset1.Fields.Item("c_name_1").Value)%>" if "<%=(Recordset1.Fields.Item("c_name_1").Value)%>"="" then disabled="disabled" %></td>
我已经解决了,多谢大家的帮忙,上面的if "<%=(Recordset1.Fields.Item("c_name_1").Value)%>"="" then disabled="disabled" %>这句就行了

<input type="text" name="textfield" value="<%= rs("TITLE") %>" <%If rs("TITLE")<>"" Then Response.Write"readonly" %> />

你是要这效果吗
假如一个留言板,有留言,没有回复的信息,就显示暂无回复
<%if isnull(rs(5)) then%>
暂无回复
<%else%>
<%=rs(5)%>
<%end if%>
isnull意思就是空值,但是如果恢复的字段在留言时候是用""空数据添加进去的话这样就不行,就直接if rs(5)="" then这样判断即可