asp 搜索语句问题

来源:百度知道 编辑:UC知道 时间:2024/05/11 03:37:13
页面中显示是一个搜索的对话框,最后一个为关键字的对话框,对话框里默认显示“关键字”,如果直接点搜索,结果为空,在对话框内部点鼠标,“关键字”仍然显示,将之删除后,再点搜索,才出现结果。我对ASP不是很精通。
但我想如果让对话框默认无显示的话,应能解决此问题。
如能帮忙搞定,30分全部相送。
Q:512727099

你可以在提交时判断一下当前搜索关键字输入框中是否为“关键字”,如果是则清空后再提交,如:
<SCRIPT Language="VBScript">
Function frmInput_OnSubmit()
If frmInput.txtSearch.value="关键字" Then frmInput.txtSearch.value= ""
End Function
</SCRIPT>
<form method=post action="" name="frmInput">
<input type="text" name="txtSearch" value="关键字">
<input type="submit" value="提交">
</form>

if text="关键字" then return

用判断或替换的办法,将"关键字"置为空:
<%
texts=request("texts")
if texts="关键字" then
texts=""
end if
'或
if texts<>"" then
texts=replace(texts,"关键字","")
end if
%>