欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS實(shí)現(xiàn)同時(shí)搜索百度和必應(yīng)的方法

 更新時(shí)間:2015年01月27日 14:31:39   投稿:shichen2014  
這篇文章主要介紹了JS實(shí)現(xiàn)同時(shí)搜索百度和必應(yīng)的方法,可實(shí)現(xiàn)在底部的兩個(gè)框架中同時(shí)顯示兩個(gè)搜索引擎的搜索結(jié)果,是非常實(shí)用的技巧,需要的朋友可以參考下

本文實(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的代碼:

復(fù)制代碼 代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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的代碼如下:

復(fù)制代碼 代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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ì)有所幫助。

相關(guān)文章

最新評(píng)論