注册 登录
编程论坛 ASP技术论坛

字段name数据等于字段other时,如何把字段other数据或字段name数据标注红色呢?

a190066 发布于 2012-08-03 13:18, 410 次点击
如果字段name数据等于李生时,可以把李生标注红色。代码如下:

<%if rs("name")="李生" then%>
<font color="red"><%=rs("name")%></font><%else%><%=rs("name")%><%end if%>

但如果字段name数据等于字段other时,如何把字段other数据或字段name数据标注红色呢?
3 回复
#2
yms1232012-08-03 16:34
你说的是搜索引擎关键字标红色吗?
Response.Write Replace(rs("othre"),rs("name"),"<font color=red >"&rs("name")&"</font>")
使用Replace函数进行替换
#3
a1900662012-08-03 18:16
回复 2楼 yms123
<td><%=rs("name1")%></td>
<td><%if rs("name")="李生" then%>'如果name=李生,李生就是红色的字体。如果不是李生是一个段other又如何表达
<font color="red"><%=rs("name")%></font><%else%><%=rs("name")%><%end if%></td>
#4
a1900662012-08-03 19:48
问题已解决,谢谢高手的指点。。
<input name="NoNoNo1" size="51" style="border-style: solid; border-width: 1" onfocus=this.select() onmouseover=this.focus()  rows=4 value="<%if rs("name")=rs("other") then
Response.Write Replace(rs("name"),rs("other"),"<font color=red>"&rs("other")&"</font>")
else
Response.Write rs("other")
end if%>">
1