找回密码
 立即注册
首页 资源区 代码 如何创建你的百Google度!!(实现双搜索引擎页面) ...

如何创建你的百Google度!!(实现双搜索引擎页面)

懵径 2025-11-19 00:05:01
创建双搜索引擎页面

百Google度的网站被封了,但!!!这不影响我们创建属于自己的双搜索引擎页面!提前准备
找到你想添加的俩个搜索引擎对应的URI 和 它预先定义用于存储搜索关键词的参数名
打开你想要的搜索引擎的网页,在当前搜索引擎里输入“关键词”,点击搜索,然后观察上面的网址,一般“?”前出现的是对应的【URI】,“&”的后面到你输入的“关键词”前,是当前搜索引擎预定义的【参数名】
一些示例(e.g.):

  • 【360】https://www.so.com/s    q
  • 【搜狐】https://search.sohu.com/s   keyword
  • 【百度】https://www.baidu.com/s    wd
  • 【Microsoft Bing】https://cn.bing.com/search   q
    等等等等等~~~
下面代码统一以【Microsoft Bing】和【360】为例:
Part.One HTML结构实现

点击查看代码
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>双搜索引擎</title>
  6. </head>
  7. <body>
  8.     <h1>Bing & 360 双搜索</h1>
  9.    
  10.    
  11.     <input id="searchInput" />
  12.     <input type="button" onclick="performSearch()" value="双搜"/>
  13.    
  14.    
  15.     <form name="bingForm" action="https://cn.bing.com/search" target="leftFrame">
  16.         <input type="hidden" name="q"/>         
  17.     </form>
  18.     <form name="soForm" action="https://www.so.com/s" target="rightFrame">
  19.         <input type="hidden" name="q"/>
  20.     </form>
  21.    
  22.    
  23.     <iframe name="leftFrame" ></iframe>
  24.     <iframe name="rightFrame" ></iframe>
  25. </body>
  26. </html>
复制代码
Part.Two JavaScript交互逻辑

点击查看代码[code][/code]
回顾:设计思路

分析页面的核心需求:
1. 一个输入框接收用户搜索词
2. 一个触发搜索的按钮
3. 两个隐藏表单分别对应不同搜索引擎
4. 两个iframe展示搜索结果
OK那么我们就完成了百Google度的创建了!撒花!!

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

相关推荐

您需要登录后才可以回帖 登录 | 立即注册