Site Search Script Example one (JavaScript)

Source: Internet
Author: User
Tags range
Script Script Description:
The first step: Add the following code to the <body> area
<script language= "JavaScript" >
<!--
The following is the full path or relative path of the page responsible for searching
var search_htm_url = "searchsource.htm";

function Searchpage () {
if ((document.searchpage.keyword.value.length = 0)
|| (Document.searchpage.keyword.value = "")) {
Alert ("Please fill in the keyword!");
} else {
sel = Document.searchpage.and_or.selectedIndex;
Location.href = Search_htm_url + "?"
+ Escape (Document.searchpage.keyword.value)
+ (sel==0?) &and ":(sel==2?" &exact ":" &or "));
}
return false;
}

document.write (' <form name= "searchpage" onsubmit= "return Searchpage ()" > "
+ ' Please fill in the keyword: <input type= ' text ' size=22 name= ' keyword ' > '
+ ' <input type= button ' value= ' Search ' onclick= ' searchpage () ' ><br> '
+ ' <select name= ' and_or ' size=1><option> keyword with search <option> keyword or search '
+ ' <option> keyword XOR or search </select></form> ');
-->
</script>


Step Two: Create a new searchsource.htm whose contents are
<!--code starts-->
<form name= "Database" >
<input type= "hidden" name= "list"
Value= "http://www.njcatv.net~ Nanjing cable TV website |NJCATV Nanjing Cable TV web page special effects av space News JavaScript
Java Applet Health Bridge ^ provides a full range of information and assistance to the general public in Nanjing *http://www.sina.com.cn~ the most complete Chinese news department site
|sina Sina News Super leverling chat room ^ China's largest news website!*http://www.163.net~ the largest comprehensive Chinese website |163 netease
NetEase Lei Ding News yeah 126 entertainment freemail Chat Room ^ The largest comprehensive Chinese website, to provide you with a full range of information, you are good to go online
Department!*http://www.sohu.com~ 's largest Chinese engine search site |sohu searches search engine Charles Zhang chat room ^ largest Chinese engine search site,
It's the best place for you to find information on the Internet!*http://www.sohu.com~ the largest Chinese engine search site |sohu searches search engine Charles Zhang chat room ^
The largest Chinese engine search site, is your best place to find information on the Internet!*http://www.sohu.com~ the largest Chinese engine search site |sohu searches
Search engine Charles Zhang Chat room ^ The largest Chinese engine search site, is your best place to find information on the Internet!*http://www.sohu.com~ the largest Chinese
Engine search site |sohu search engine Charles Zhang Chat room ^ The largest Chinese engine search site, you are the best place to find information on the internet!
*http://www.sohu.com~ 's largest Chinese engine search site |sohu searching search engine Charles Zhang Chat room ^ The largest Chinese engine search site, is
The best place for you to find information on the Internet!*http://www.sohu.com~ the largest Chinese engine search site, the |sohu search engine Charles Zhang chat room ^ most
The big Chinese engine search site, you are the best place to find information on the internet! >
</form>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.