因為搜索過程中很有可能出現搜索的內容不存在的情況,所以我們這里一定要添加一個“假如記錄集不為空則顯示”的服務器行為。選中動態數據所在的那一行(<tr>...</tr>),點擊“服務器行為”中的“顯示區域”>“假如記錄集不為空則顯示”。再找到 <% end if end not search.eof or not search.bof %> 所在的地方,在前面添加幾行代碼,成為如下: <% else %> <tr><td>你所查詢的內容不存在,請更改要害詞后再查詢!</td></tr> <% end if end not search.eof or not search.bof %>
<% function showbold(thefield) set objregexp= new regexp objregexp.pattern="(" & request.form("keyword") & ")" 其中的keyword要和index.htm中文本框的名字一致||| objregexp.ignorecase=true objregexp.global=true showbold=objregexp.replace(thefield,"<font color=red><b>$1</b></font>") end function %>