重复利用代码的问题
<%
If Not request.Form("soutext") Is Nothing Then
Response.Write request.Form("soutext")
End If
If Not Request("searchkey") Is Nothing Then
Response.Write Server.HtmlEncode(Request("searchkey"))
End If
%>
上面这段代码要在一个页面中重复写好多次,能不能在最上面些一次,下面一句话调用?怎么弄?
------解决方案--------------------
soutext=request.Form("soutext")
response.write soutext
------解决方案--------------------VBScript code
function aa(na)
If Not Request(na) Is Nothing Then
aa=Server.HtmlEncode(Request(na))
End If
end function
response.write(aa(soutext))
response.write(aa(searchkey))
------解决方案--------------------
response.write(aa("soutext"))
response.write(aa("searchkey")
忘记加""了,你试试,应该可以。好久没写asp的东西了。