国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

JS實現同時搜索百度和必應的方法

2024-05-06 16:15:21
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了JS實現同時搜索百度和必應的方法,可實現在底部的兩個框架中同時顯示兩個搜索引擎的搜索結果,是非常實用的技巧,需要的朋友可以參考下
 

本文實例講述了JS實現同時搜索百度和必應的方法。分享給大家供大家參考。具體如下:

這里實現同時搜索百度和必應的功能,輸入關鍵字,點擊“搜一下”按鈕,兩個搜索引擎的結果在同個頁面打開,方便。

將下面這兩個htm文件保存,放在同一個文件夾下,打開第一個文件就可以了。
index.htm的代碼:

復制代碼代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>同時搜索百度和必應</title>
<meta http-equiv="keywords" content="同時搜索百度和必應">
<meta http-equiv="description" content="同時搜索百度和必應">
</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>

 

第二個的文件名為keleyi.htm

keleyi.htm的代碼如下:

復制代碼代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>同時搜索百度和必應</title>

 

<meta http-equiv="keywords" content="同時搜索百度和必應">
<meta http-equiv="description" content="同時搜索百度和必應">

<!--<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");
//提交給百度,構造地址參數
oForm.action = "http://www.baidu.com/s";
okeyword.name = "wd";
oForm.method = "get";
oForm.target = "baiduFrame";
oForm.submit();
//提交給bing,構造地址參數
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>

 

希望本文所述對大家的javascript程序設計有所幫助。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 栾川县| 甘孜县| 赣榆县| 延津县| 辉南县| 丰顺县| 邯郸县| 清流县| 富阳市| 铜山县| 浦东新区| 无棣县| 兰坪| 库车县| 察隅县| 五指山市| 灵宝市| 阿城市| 吐鲁番市| 汕尾市| 革吉县| 双峰县| 宽城| 朔州市| 大丰市| 永春县| 信宜市| 勐海县| 肃南| 兴文县| 平安县| 房产| 通化市| 黎川县| 龙南县| 富锦市| 拜城县| 宿迁市| 青海省| 闽清县| 嘉兴市|