JS implements the method of searching Baidu and Bing at the same time, and js implements Baidu search

Source: Internet
Author: User

JS implements the method of searching Baidu and Bing at the same time, and js implements Baidu search

This article describes how to search Baidu and Bing simultaneously using JS. Share it with you for your reference. The details are as follows:

Here, you can search for Baidu and Bing at the same time. Enter the keyword and click "Search". The results of the two search engines are displayed on the same page for convenience.

Save the following two htm files in the same folder and open the first file.
Code for index.htm:
Copy codeThe Code is as follows: <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<Title> Search Baidu and Bing at the same time </title>
<Meta http-equiv = "keywords" content = "Search Baidu and Bing">
<Meta http-equiv = "description" content = "Search Baidu and Bing">
</Head>

<! -- <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> -->
</Html>

The second file is named keleyi.htm.

The keleyi.htm code is as follows:
Copy codeThe Code is as follows: <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<Title> Search Baidu and Bing at the same time </title>

<Meta http-equiv = "keywords" content = "Search Baidu and Bing">
<Meta http-equiv = "description" content = "Search 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 it to Baidu to construct address parameters
OForm. action = "http://www.baidu.com/s ";
Okeyword. name = "wd ";
OForm. method = "get ";
OForm.tar get = "baiduFrame ";
OForm. submit ();
// Submit it to bing to construct address parameters
OForm. action = "http://hk.bing.com/search ";
Okeyword. name = "q ";
OForm. method = "get ";
OForm.tar get = "bingFrame ";
OForm. submit ();
}
</Script>
</Head>

<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>
<Hr/>

</Body>
</Html>

I hope this article will help you design javascript programs.

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.