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

脚本说明:
第一步:把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide Script from Old Browsers
Keyword = new Object();
Descrip = new Object();
Address = new Object();


// Keyword[0] = n (where n is the number of keywords which can be searched
Keyword[0] = 5 //对应查询组的数量;

Keyword[1] = "javascript"
Descrip[1] = "最全的javascript资源站-javascript2000.com"
Address[1] = "http://www.javascript2000.com"

Keyword[2] = "javascript"
Descrip[2] = "很好的javascript站点"
Address[2] = "http://www.cnlot.com/"

Keyword[3] = "javascript"
Descrip[3] = "java神捕"
Address[3] = "http://pcafei.3322.net/"

Keyword[4] = "javascript"
Descrip[4] = "精彩天地"
Address[4] = "http://demoy.3322.net/"

Keyword[5] = "javascript"
Descrip[5] = "国外最大的javascript资源站"
Address[5] = "http://www.javascript.com/"
function checkDatabase() {

var Found = false
var Item = document.forms[0].searchfor.value.toLowerCase();

stats='toolbar=no,location=no,directories=no,status=no,menubar=no,'
stats += 'scrollbars=yes,resizable=yes'
MsgBox = window.open ("","msgWindow",stats)
MsgBox.document.write("<head><title>查询结果</title></head>");
MsgBox.document.write ("<BODY BGCOLOR=#ffffff TEXT=#000000 LINK=#000080 VLINK=#800040
ALINK=#FF0000><CENTER>查询结果</CENTER>")
MsgBox.document.write ("For the keyword: "+Item+"<HR>");
for (var i=1; i <= Keyword[0]; i++) {
if(Item == Keyword[i]) {
Found = true;
MsgBox.document.write (Descrip[i]+"<BR><A HREF="http://www.php1.cn/">

}
}
if(!Found)
MsgBox.document.write ("没有发现与该关键词有关的条目。")
MsgBox.document.write ("<H6>Enjoy it!<BR><A HREF="http://www.php1.cn/">MsgBox.document.write ("<FORM class='pt9'><CENTER>")
MsgBox.document.write ("<INPUT type='button' value='关闭查询窗口' onClick = 'self.close()'>")
MsgBox.document.write ("</CENTER></FORM>") }
// -->
</SCRIPT>

如下代码生成查询表单界面:

<form name="form1">
<u>请输入查询关键词:</u><br>
<input type="text" name="searchfor" value="" size=20>
<input type="button" value="查询" onClick="checkDatabase()" name="button">
<br>
<!-- End Of File -->
<font color="#FF0000">输入小写字符</font>
<p>
</form>

以上就是站内搜索脚本例子五(javascript)_Javascript教程的内容,更多相关内容请关注龙方网络(www.yzlfxy.com)!

郑重声明:本文版权包含图片归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们(delete@yzlfxy.com)修改或删除,多谢。

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

留言与评论(共有 0 条评论)
昵称:
匿名发表
   
验证码: