这是一款在当前页面中检索筛选关键字效果,用户只要在文本框内输入关键字点击按钮即可实现,实用的一种网页特效。
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script language = "JavaScript"> var key = ""; function makeEntry () { this.Name=""; this.URL = ""; this.Desc = ""; return this; } function makeArray(n) { this.length = n; for (var k = 1; k <= n; k++) { this[k] = ""; } return this; } function makeLinks(size) { this.length = size; for (var r=1; r<= size; r++) { this[r] = new makeEntry(); this[r].Name = namesArray[r]; this[r].URL = urlsArray[r]; this[r].Desc = descArray[r]; } return this; } var linksize=0; namesArray = new makeArray(linksize); urlsArray = new makeArray(linksize); descArray = new makeArray(linksize); //武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var arraycount=0; <!-- 以下是数据库部分,随意添加和删除--> arraycount += 1 urlsArray[arraycount] = "https://wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "一号!" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "四号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "五号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "六号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "七号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "八号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "九号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十一号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十二号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十三号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十四号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十五号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十六号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十七号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十八号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "十九号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十一号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十二号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十三号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十四号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十五号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十六号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十七号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十八号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "二十九号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三十号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三十一号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三十二号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三十三号" arraycount += 1 urlsArray[arraycount] = "https://wwww.wuming.ren" namesArray[arraycount] = "武鸣人,各种信息免费发布,资源共享合作共赢!" descArray[arraycount] = "三十四号" linksize = arraycount; function searchLinks(links, keyword, hits, dirw) {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var resultcount=0; <!-- 如下是生成查询结果显示页面!外观自己可以修改相应代码即可! --> document.write('<HTML>'); document.write('<BODY BGCOLOR=#000000 TEXT=white LINK=yellow VLINK=yellow ALINK=yellow>'); document.write('<CENTER><TABLE BORDER=3 CELLSPACING=0 CELLPADDING=3 BGCOLOR=\"#ff0000\"><TR><TD><CENTER><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3 BGCOLOR=\"#42526B\"><TR><TD>'); document.write("<CENTER><font color=red>Results for keywords: </font><font size=5 color=yellow>" +keyword +"</font></CENTER>"); document.write('</TD></TR></TABLE></CENTER></TD></TR></TABLE></CENTER><P>'); document.write('<OL>'); for (var q=1; q<=links.length; q++) { if (links[q].URL.toLowerCase().indexOf(dirw) != -1) { if (links[q].Desc.toLowerCase().indexOf(keyword) != -1) { resultcount += 1; if (resultcount > hits) { break; } else { document.write("<LI>"); document.write("<a href=\"" + links[q].URL + "\">" + links[q].Name + "</a>"); document.write(" -" + links[q].Desc + "<br>"); continue; } } if (links[q].Name.toLowerCase().indexOf(keyword) != -1) { resultcount += 1; if (resultcount > hits) { break; } else { document.write("<LI>"); document.write("<a href=\"" + links[q].URL + "\">" + links[q].Name + "</a>"); document.write(" -" + links[q].Desc + "<br>"); continue; } } } } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> <script> <!-- 如下是表单合法性检查,主要是避免一些非法字符的查询! --> function validate_form() {//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) txt = document.form.search.value; newindex = document.form.numhits.selectedIndex; dahits = document.form.numhits[newindex].value; newindexb = document.form.whichdir.selectedIndex; dadir = document.form.whichdir[newindexb].value; if (txt.indexOf(".") != -1){ alert("Search is invalid! Contains a '.'"); return;} if (txt.indexOf(",") != -1){ alert("Search is invalid! Contains a ','"); return;} if (txt.indexOf("@") != -1){ alert("Search is invalid! Contains a '@''"); return;} if (txt.indexOf("!") != -1){ alert("Search is invalid! Contains a '!''"); return;} if (txt.indexOf("#") != -1){ alert("Search is invalid! Contains a '#''"); return;} if (txt.indexOf("$") != -1){ alert("Search is invalid! Contains a '$''"); return;} if (txt.indexOf("%") != -1){ alert("Search is invalid! Contains a '%''"); return;} if (txt.indexOf("^") != -1){ alert("Search is invalid! Contains a '^''"); return;} if (txt.indexOf("&") != -1){ alert("Search is invalid! Contains a '&''"); return;} if (txt.indexOf("*") != -1){ alert("Search is invalid! Contains a '*''"); return;} if (txt.indexOf("(") != -1){ alert("Search is invalid! Contains a '(''"); return;} if (txt.indexOf(")") != -1){ alert("Search is invalid! Contains a ')''"); return;} if (txt.indexOf("[") != -1){ alert("Search is invalid! Contains a '[''"); return;} if (txt.indexOf("]") != -1){ alert("Search is invalid! Contains a ']''"); return;} if (txt.indexOf(";") != -1){ alert("Search is invalid! Contains a ';''"); return;} if (txt.indexOf(":") != -1){ alert("Search is invalid! Contains a ':''"); return;} if (txt.indexOf("<") != -1){ alert("Search is invalid! Contains a '<''"); return;} if (txt.indexOf(">") != -1){ alert("Search is invalid! Contains a '>''"); return;} if (txt.indexOf("?") != -1){ alert("Search is invalid! Contains a '?''"); return;} if (txt.indexOf("=") != -1){ alert("Search is invalid! Contains a '=''"); return;} if (txt.indexOf("+") != -1){ alert("Search is invalid! Contains a '+''"); return;} else { jsi = new makeLinks(linksize); searchLinks(jsi, txt, dahits, dadir); document.write('</OL>'); document.write('<font color=red>....... 查询结果结束 .......</font><P>'); document.write('<hr>'); document.write('</body></html>'); } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <table width=59% border=1 cellpadding=0 cellspacing=0 align=center valign=top> <tr> <td width=100% align=left bgcolor=#42526B height="232"> <form name="form"> <center> <font color="yellow"> </font> </center> <center> <font color="yellow">关键字(小写字符,支持中文):</font> <font color="yellow"><b> <input name="search" type=text size="20" value="一号"> </b> </font> </center> <font color="yellow"><b><br> </b> </font> <center> <font color="#FFFF00">返回记录数:</font> <font color="yellow"><font face="Arial, Helvetica, sans-serif"> <select name="numhits" size="1"> <option selected value="25">25 <option value="50">50 <option value="75">75 <option value="100">100 <option value="150">150 <option value="200">200 </select> </font>检索分类<font face="Arial, Helvetica, sans-serif"> </font><b><font size=3><font size=3> <select size=1 name="whichdir" class="pt9"> <option selected value="http">ALL <option value="java">javaScript <option value="business">Business <option value="commun">Communications <option value="desktop">Desktop <option value="educate">Education <option value="games">Games <option value="graphics">Graphics <option value="hobby">Hobby <option value="homeuse">Home Use <option value="inet">Internet <option value="multi">Multimedia <option value="program">Programming <option value="tools">System Tools </select> </font></font> </b> </font> </center> <font color="yellow"><b><font size=3><font size=3> <br> <br> </font></font></b></font><font color=yellow size=3><font color=yellow size=3> <center> <font color="yellow"><b> <input type="button" name="submit" value="Search" onClick="validate_form()"> <input type="reset" name="reset" value=" Clear "> </b> </font> </center> </font></font> </form>
本文来自武鸣人网站,转载请注明出处