脚本说明:第一步:把如下代码加入区域中<br><!-- Hide Script from Old Browsers<br/>Keyword = new Object();<br/>Descrip = new Object();<br/>Address = new Object();</p><p><br/></p><p>// Keyword[0] = n (where n is the number of keywords which can be searched<br/>Keyword[0] = 5 //对应查询组的数量;</p><p>Keyword[1] = "javascript"<br/>Descrip[1] = "最全的javascript资源站-javascript2000.com"<br/>Address[1] = "http://www.javascript2000.com"</p><p>Keyword[2] = "javascript"<br/>Descrip[2] = "很好的javascript站点"<br/>Address[2] = "http://www.cnlot.com/"</p><p>Keyword[3] = "javascript"<br/>Descrip[3] = "java神捕"<br/>Address[3] = "http://pcafei.3322.net/"</p><p>Keyword[4] = "javascript"<br/>Descrip[4] = "精彩天地"<br/>Address[4] = "http://demoy.3322.net/"</p><p>Keyword[5] = "javascript"<br/>Descrip[5] = "国外最大的javascript资源站"<br/>Address[5] = "http://www.javascript.com/"<br/>function checkDatabase() {</p><p>var Found = false<br/>var Item = document.forms[0].searchfor.value.toLowerCase();</p><p>stats='toolbar=no,location=no,directories=no,status=no,menubar=no,' <br/>stats += 'scrollbars=yes,resizable=yes' <br/>MsgBox = window.open ("","msgWindow",stats) <br/>MsgBox.document.write("<head><title>查询结果</title></head>");<br>MsgBox.document.write ("<BODY BGCOLOR=#ffffff TEXT=#000000 LINK=#000080 VLINK=#800040 <br/>ALINK=#FF0000><CENTER>查询结果</CENTER>") <br>MsgBox.document.write ("For the keyword: "+Item+"<HR>");<br>for (var i=1; i <= Keyword[0]; i++) {<br/>if(Item == Keyword[i]) {<br/>Found = true;<br/>MsgBox.document.write (Descrip[i]+"<BR><A HREF="http://www.php1.cn/"></p> <p>}<br>}<br>if(!Found)<br>MsgBox.document.write ("没有发现与该关键词有关的条目。") <br>MsgBox.document.write ("<H6>Enjoy it!<BR><A HREF="http://www.php1.cn/">MsgBox.document.write ("<FORM class='pt9'><CENTER>") <br>MsgBox.document.write ("<INPUT type='button' value='关闭查询窗口' onClick = 'self.close()'>") <br>MsgBox.document.write ("</CENTER></FORM>") }<br>// --><br> 如下代码生成查询表单界面: 请输入查询关键词: 输入小写字符 以上就是站内搜索脚本例子五(javascript)_Javascript教程的内容,更多相关内容请关注PHP中文网(www.php.cn)!