JS實(shí)現(xiàn)同時(shí)搜索百度和必應(yīng)的方法
本文實(shí)例講述了JS實(shí)現(xiàn)同時(shí)搜索百度和必應(yīng)的方法。分享給大家供大家參考。具體如下:
這里實(shí)現(xiàn)同時(shí)搜索百度和必應(yīng)的功能,輸入關(guān)鍵字,點(diǎn)擊“搜一下”按鈕,兩個(gè)搜索引擎的結(jié)果在同個(gè)頁(yè)面打開(kāi),方便。
將下面這兩個(gè)htm文件保存,放在同一個(gè)文件夾下,打開(kāi)第一個(gè)文件就可以了。
index.htm的代碼:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>同時(shí)搜索百度和必應(yīng)</title>
<meta http-equiv="keywords" content="同時(shí)搜索百度和必應(yīng)">
<meta http-equiv="description" content="同時(shí)搜索百度和必應(yīng)">
</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>
第二個(gè)的文件名為keleyi.htm
keleyi.htm的代碼如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>同時(shí)搜索百度和必應(yīng)</title>
<meta http-equiv="keywords" content="同時(shí)搜索百度和必應(yīng)">
<meta http-equiv="description" content="同時(shí)搜索百度和必應(yīng)">
<!--<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");
//提交給百度,構(gòu)造地址參數(shù)
oForm.action = "http://www.baidu.com/s";
okeyword.name = "wd";
oForm.method = "get";
oForm.target = "baiduFrame";
oForm.submit();
//提交給bing,構(gòu)造地址參數(shù)
oForm.action = "http://hk.bing.com/search";
okeyword.name = "q";
oForm.method = "get";
oForm.target = "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="搜一下~" onclick="mixSearch();" />
</form>
<hr />
</body>
</html>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
- JS+CSS實(shí)現(xiàn)仿新浪微博搜索框的方法
- JS實(shí)現(xiàn)關(guān)鍵字搜索時(shí)的相關(guān)下拉字段效果
- JS使用replace()方法和正則表達(dá)式進(jìn)行字符串的搜索與替換實(shí)例
- JS仿百度搜索自動(dòng)提示框匹配查詢(xún)功能
- 用JS將搜索的關(guān)鍵字高亮顯示實(shí)現(xiàn)代碼
- js實(shí)現(xiàn)帶搜索功能的下拉框?qū)崟r(shí)搜索實(shí)時(shí)匹配
- JS性能優(yōu)化筆記搜索整理
- 利用PHP+JS實(shí)現(xiàn)搜索自動(dòng)提示(實(shí)例)
- JS實(shí)現(xiàn)表格數(shù)據(jù)各種搜索功能的方法
相關(guān)文章
JavaScript中callee和caller的區(qū)別與用法實(shí)例分析
這篇文章主要介紹了JavaScript中callee和caller的區(qū)別與用法,結(jié)合實(shí)例形式分析了javascript中callee和caller的功能、區(qū)別、用法及操作注意事項(xiàng),需要的朋友可以參考下2019-06-06
js實(shí)現(xiàn)input密碼框提示信息的方法(附html5實(shí)現(xiàn)方法)
這篇文章主要介紹了js實(shí)現(xiàn)input密碼框提示信息的方法,涉及JavaScript頁(yè)面元素的獲取,屬性判斷及樣式設(shè)置等技巧,并附帶html5的相關(guān)實(shí)現(xiàn)方法,需要的朋友可以參考下2016-01-01
JS關(guān)閉窗口與JS關(guān)閉頁(yè)面的幾種方法小結(jié)
本篇文章要是對(duì)JS關(guān)閉窗口與JS關(guān)閉頁(yè)面的幾種方法進(jìn)行了總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-12-12
JS桶排序的簡(jiǎn)單理解與實(shí)現(xiàn)方法示例
這篇文章主要介紹了JS桶排序的簡(jiǎn)單理解與實(shí)現(xiàn)方法,結(jié)合實(shí)例形式詳細(xì)分析了js桶排序的概念、原理、實(shí)現(xiàn)方法及操作注意事項(xiàng),需要的朋友可以參考下2019-11-11
javascript Excel操作知識(shí)點(diǎn)
使用JavaScript中的ActiveXObject填充并設(shè)置Excel格式2009-04-04

