이 기사에서는 Baidu와 Bing을 동시에 검색하는 JS의 방법에 대해 설명합니다. 참조를 위해 공유하십시오. 세부 사항은 다음과 같습니다.
여기서 우리는 Baidu 및 Bing을 동시에 검색하고 키워드를 입력하고 "검색"버튼을 클릭하면 두 검색 엔진의 결과가 같은 페이지에서 열리게됩니다. 편리합니다.
다음 두 HTM 파일을 저장하고 동일한 폴더에 배치 한 다음 첫 번째 파일을 엽니 다.
index.htm 코드 :
다음과 같이 코드를 복사하십시오. <! doctype html public "-// w3c // dtd html 4.01 Transitional // en">
<html>
<헤드>
<meta http-equiv = "content-type"content = "text/html; charset = utf-8">
<title> Baidu와 Bing을 동시에 검색 </title>
<meta http-equiv = "키워드"content = "동시에 Baidu 및 Bing 검색">
<meta http-equiv = "description"content = "Baidu 및 Bing 검색 동시에">
</head>
<!-<Body Style = "Text-Align : Center;">
->
<프레임 세트 행 = "30%, 70%">
<frame src = "keleyi.htm">
</프레임>
<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"> </iframe>
<iframe id = "bingframe"> </iframe>
</body>->
</html>
두 번째 파일 이름은 keleyi.htm입니다
keleyi.htm의 코드는 다음과 같습니다.
다음과 같이 코드를 복사하십시오. <! doctype html public "-// w3c // dtd html 4.01 Transitional // en">
<html>
<헤드>
<meta http-equiv = "content-type"content = "text/html; charset = utf-8">
<title> Baidu와 Bing을 동시에 검색 </title>
<meta http-equiv = "키워드"content = "동시에 Baidu 및 Bing 검색">
<meta http-equiv = "description"content = "Baidu 및 Bing 검색 동시에">
<!-<link rel = "스타일 시트"유형 = "text/css"href = "./ styles.css">->
<script type = "text/javaScript">
함수 $ (id) {
return document.getElementById (id);
}
함수 mixsearch () {
var okeyword = $ ( "키워드");
var oform = $ ( "searchform");
// 주소 매개 변수를 구성하려면 Baidu에 제출합니다
oform.action = "http://www.baidu.com/s";
Okeyword.name = "wd";
oform.method = "get";
oform.target = "baiduframe";
oform.submit ();
// 빙에 제출하고 주소 매개 변수를 구성하십시오
oform.action = "http://hk.bing.com/search";
Okeyword.name = "Q";
oform.method = "get";
oform.target = "bingframe";
oform.submit ();
}
</스크립트>
</head>
<Body Style = "Text-Align : Center;">
<form action = ""id = "searchform"method = "get"target = "baiduframe">
<입력 유형 = "텍스트"id = "키워드"이름 = "wd"value = "" />
<입력 유형 = "버튼"value = "search ~"onclick = "mixsearch ();" />
</form>
<hr />
</body>
</html>
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.