Phiên bản đầy đủ: jsB@nk » Ứng dụng » Tìm kiếm » Tìm kiếm đơn giản
URL: https://www.javascriptbank.com/search-in-this-page.html
Một công cụ tìm kiếm ngay bên trong trang web
Phiên bản đầy đủ: jsB@nk » Ứng dụng » Tìm kiếm » Tìm kiếm đơn giản
URL: https://www.javascriptbank.com/search-in-this-page.html
<script language="JavaScript"> ////////////////////////////////////////////////////////////////////////////////// // // // keyword[x] is the keyword search object // // As of now, there is only 5 keywords // // To add more keywords, add keyword[x], x being the number of the keyword // // Example: To add a sixth key word, it would look like this: // // keyword[6] = "Keyword goes here" // // descrip[x] is the description that goes along with the keyword // // In descrip[x], x must be equal to it's cooresponding keyword // // Example: descrip[0] ="text text" is the description for keyword[0] // // Add descriptions the same way you add keywords // // // // Don't forget to include the onLoad command in the body tag: // // <body onLoad="search()"> // // // ////////////////////////////////////////////////////////////////////////////////// // To use this script freely and legally, keep the following lines intact // // This script was created by Jeff McClay ©2001 All Rights Reserved // ////////////////////////////////////////////////////////////////////////////function search(){ keyword = new Array()keyword[1] = "javascript"keyword[2] = "news"keyword[3] = "html"keyword[4] = "http://jsbank.beplaced.com/"keyword[5] = "home page"keyword[6] = "hey now"keyword[7] = "what"num = 1descrip = new Array()descrip[1] = "<P ALIGN=justify>JavaScript is the language that this script is written in. You can find lots of great JavaScripts at <A HREF=http://jsbank.beplaced.com/ TARGET=top> JSBank</a></p>"descrip[2] = "<P ALIGN=justify>You can get plenty of news at <A HREF=http://www.cnn.com TARGET=top> cnn.com</a>" descrip[3] = "<P ALIGN=justify>Don't know any HTML? You can learn it all yourself at <A HREF=http://www.htmlgoodies.com TARGET=top> htmlgoodies.com</a></p>"descrip[4] = "<P ALIGN=justify>This is description 4."descrip[5] = "<P ALIGN=justify>This is description 5."descrip[6] = "<P ALIGN=justify>This is description 6."descrip[7] = "<P ALIGN=justify>This is description 7." <!------DON'T EDIT------>var openwindow = window.open ("","open",config="height=300,width=400, scrollbars=no, scrolling=no") var query = document.srch.ursrch.value.toLowerCase();var found = false <!----END DON'T EDIT----> /////////////////////////////////////////////////////////////////////////////////////// // // // If you added more keywords, and descriptions, you must add another if statement // // that cooresponds with the keyword and descrip // // Example: // // If you added keyword[6] and descrip[6], you must also add: // // // // if (guess == keyword[5]) {num = 5} // // // /////////////////////////////////////////////////////////////////////////////////////// if (query == keyword[1]) {num = 1; found = true} if (query == keyword[2]) {num = 2; found = true} if (query == keyword[3]) {num = 3; found = true} if (query == keyword[4]) {num = 4; found = true} if (query == keyword[5]) {num = 5; found = true} if (query == keyword[6]) {num = 6; found = true} if (query == keyword[7]) {num = 7; found = true} <!------DON'T EDIT------> if (found == true) { openwindow.document.write("<HTML>") openwindow.document.write("<TITLE>Search results for: " +query+ "</title>") openwindow.document.write("<BODY BGCOLOR=orange>") openwindow.document.write("<H2><B><CENTER>Matches Found for " +keyword[num]+ "</b></h2>") openwindow.document.write("<HR WIDTH=85%</center>") openwindow.document.write(descrip[num]) openwindow.document.write ("<FORM><CENTER>") openwindow.document.write ("<INPUT type='button' value='Close' onClick = 'self.close()'>") openwindow.document.write ("</CENTER></FORM><P> <P> <P> <P> <P> <P> <P> <P> <P> ") openwindow.document.write("</body>") openwindow.document.write("</html>") } if (found == false) { openwindow.document.write("<HTML>") openwindow.document.write("<TITLE>Search results for: " +query+ "</title>") openwindow.document.write("<BODY BGCOLOR=orange>") openwindow.document.write("<H2><B><CENTER>No matches Found for " +query+ "</b></h2>") openwindow.document.write("<HR WIDTH=85%</center>") openwindow.document.write("Search Yahoo for <A HREF=http://search.yahoo.com/bin/search?p=" +query+ " TARGET=top>" +query+ "</a><BR>") openwindow.document.write("Search Goto for <A HREF=http://www.goto.com/d/search/p/go/?Partner=go_home&Keywords=" +query+ " TARGET=top>" +query+ "</a><BR>") openwindow.document.write("Search WebCrawler for <A HREF=http://search.excite.com/search.gw?lk=webcrawler&s=" +query+ " TARGET=top>" +query+ "</a><BR>") openwindow.document.write("Search Looksmart for <A HREF=http://www.looksmart.com/r_search?look=&key=" +query+ " TARGET=top>" +query+ "</a><BR>") openwindow.document.write ("<FORM><CENTER>") openwindow.document.write ("<INPUT type='button' value='Close' onClick = 'self.close()'>") openwindow.document.write ("</CENTER></FORM><P> <P> <P> <P> <P> <P> <P> <P> <P> ") openwindow.document.write("</body>") openwindow.document.write("</html>") } }<!----END DON'T EDIT----></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="srch"><table width="225" border="1" cellpadding="5" cellspacing="1" bgcolor="#ffffff" bordercolor="#000000"> <tbody><tr><td colspan="2" bgcolor="#ffffff"><center><b>Search the Database</b></center></td></tr> <tr><td bgcolor="#ffffff">Keyword:</td> <td bgcolor="#ffffff"><input name="ursrch" type="text" size="20"></td></tr> <tr><td colspan="2" align="center" bgcolor="#ffffff"><input type="submit" onclick="search()" value="Search the Database"></td></tr></tbody></table></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->