站内搜索脚本例子三(javascript)_Javascript教程

黄舟
Lepaskan: 2016-12-21 15:35:30
asal
1133 orang telah melayarinya

脚本说明:
第一步:把如下代码加入区域中

站内搜索引擎

测试:输入关键字"java" 
或中文字符"免费" 查询。


 


 

查询关键字: 










<script><br>function validate_form() {</p> <p>txt = document.form.search.value;<br>if (txt.indexOf(".") != -1){<br>alert("Search is invalid! Contains a '.'"); return;}<br>if (txt.indexOf(",") != -1){<br>alert("Search is invalid! Contains a ','"); return;}<br>if (txt.indexOf("@") != -1){<br>alert("Search is invalid! Contains a '@''"); return;}<br>if (txt.indexOf("!") != -1){<br>alert("Search is invalid! Contains a '!''"); return;}<br>if (txt.indexOf("#") != -1){<br>alert("Search is invalid! Contains a '#''"); return;}<br>if (txt.indexOf("$") != -1){<br>alert("Search is invalid! Contains a '$''"); return;}<br>if (txt.indexOf("%") != -1){<br>alert("Search is invalid! Contains a '%''"); return;}<br>if (txt.indexOf("^") != -1){<br>alert("Search is invalid! Contains a '^''"); return;}<br>if (txt.indexOf("&") != -1){<br>alert("Search is invalid! Contains a '&''"); return;}<br>if (txt.indexOf("*") != -1){<br>alert("Search is invalid! Contains a '*''"); return;}<br>if (txt.indexOf("(") != -1){<br>alert("Search is invalid! Contains a '(''"); return;}<br>if (txt.indexOf(")") != -1){<br>alert("Search is invalid! Contains a ')''"); return;}<br>if (txt.indexOf("[") != -1){<br>alert("Search is invalid! Contains a '[''"); return;}<br>if (txt.indexOf("]") != -1){<br>alert("Search is invalid! Contains a ']''"); return;}<br>if (txt.indexOf(";") != -1){<br>alert("Search is invalid! Contains a ';''"); return;}<br>if (txt.indexOf(":") != -1){<br>alert("Search is invalid! Contains a ':''"); return;}<br>if (txt.indexOf("<") != -1){<br/>alert("Search is invalid! Contains a &#39;<&#39;&#39;"); return;}<br/>if (txt.indexOf(">") != -1){<br>alert("Search is invalid! Contains a '>''"); return;}<br>if (txt.indexOf("?") != -1){<br>alert("Search is invalid! Contains a '?''"); return;}<br>if (txt.indexOf("-") != -1){<br>alert("Search is invalid! Contains a '-''"); return;}<br>if (txt.indexOf("=") != -1){<br>alert("Search is invalid! Contains a '=''"); return;}<br>if (txt.indexOf("+") != -1){<br>alert("Search is invalid! Contains a '+''"); return;}<br>else {<br>jsi = new makeLinks(linksize);<br>searchLinks(jsi, txt);<br>document.write("<hr>");<br>document.write("<a href="http://www.php1.cn/">//将searchabledb2.htm替换为检索页的URL,以便访问者返回检索页。<br>}</p> <p>}<br></script> 

 以上就是站内搜索脚本例子三(javascript)_Javascript教程的内容,更多相关内容请关注PHP中文网(www.php.cn)! 


Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!