演大汉英雄的张小玲:如何确认文本框中包含某字符。

来源:百度文库 编辑:高考问答 时间:2024/04/29 08:55:13
请问大家,“文本框content中包含某字符”这样的语句如何写?即:
if content (这里指文本框content中包含某个字符) then
response.write "<script language='javascript'>"
response.write "alert('请不要在这里发布广告');"
response.write "history.go(-1);"
response.write "</script>"
Response.End
end if

if InStr(Request.Form("content"), "某个字符") then
response.write "<script language='javascript'>"
response.write "alert('请不要在这里发布广告');"
response.write "history.go(-1);"
response.write "</script>"
Response.End
end if

instr(form1.conten.value,"@")=1
if instr(form1.conten.value,"@")=1 then
response.write "<script language='javascript'>"
response.write "alert('请不要在这里发布广告');"
response.write "history.go(-1);"
response.write "</script>"
Response.End
end if

用Instr()这个函数就可以了:
If Instr(document.form1.content.value,"广告") > 0 Then
''说明Content含有这个字符
提示信息
Else
......
End If