JS to achieve simultaneous search for Baidu and Bing methods _javascript skills

Source: Internet
Author: User

This article describes the JS implementation of both Baidu and Bing search methods. Share to everyone for your reference. Specifically as follows:

Here to achieve simultaneous search Baidu and Bing function, input keywords, click the "Search" button, two search engine results on the same page open, convenient.

Save the following two HTM files in the same folder and open the first file.
Code for index.htm:

Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> search both Baidu and Bing </title>
<meta http-equiv= "keywords" content= "search both Baidu and Bing" >
<meta http-equiv= "description" content= "search both Baidu and Bing" >

<!--<body style= "Text-align:center;" >
-->
<frameset rows= "30%,70%" >
<frame src= "Keleyi.htm" >
</frame>
<frameset cols= "45%,45%" >
<frame id= "Baiduframe" name= "Baiduframe" src= "Images/baidu.jpg" ></frame>
<frame id= "Bingframe" name= "Bingframe" src= "Images/baidu.jpg" ></frame>
</frameset>
</frameset>

<!--<iframe id= "Baiduframe" width= "49%" height= "100%" ></iframe>
<iframe id= "Bingframe" width= "49%" height= "100%" ></iframe>
</body>-->

The second file name is keleyi.htm

The code for keleyi.htm is as follows:

Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> search both Baidu and Bing </title>

<meta http-equiv= "keywords" content= "search both Baidu and Bing" >
<meta http-equiv= "description" content= "search both Baidu and Bing" >

<!--<link rel= "stylesheet" type= "Text/css" href= "./styles.css" >-->
<script type= "Text/javascript" >
function $ (ID) {
return document.getElementById (ID);
}
function Mixsearch () {
var Okeyword = $ ("keyword");
var oform = $ ("Searchform");
Submit to Baidu, construct address parameters
Oform.action = "http://www.baidu.com/s";
Okeyword.name = "WD";
Oform.method = "Get";
Oform.target = "Baiduframe";
Oform.submit ();
Submit to Bing, construct address parameters
Oform.action = "Http://hk.bing.com/search";
Okeyword.name = "Q";
Oform.method = "Get";
Oform.target = "Bingframe";
Oform.submit ();
}
</script>

<body style= "Text-align:center;" >
<form action= "" id= "Searchform" method= "Get" target= "Baiduframe" >
<input type= "text" id= "keyword" name= "wd" "value=" "/>"
<input type= "button" value= "Search ~" onclick= "Mixsearch ();"/>
</form>

</body>

I hope this article will help you with your JavaScript programming.

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.