当前位置: 首页 > news >正文

选择搜索引擎进行搜索

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>选择搜索引擎进行搜索</title>
    <script>
        function searchSelectedEngine() {
            var keyword = document.getElementById('keyword').value;
            var engine = document.getElementById('engine').value;
            var encodedKeyword = encodeURIComponent(keyword);

            var searchUrl;

            switch (engine) {
                case 'bing':
                    searchUrl = "https://www.bing.com/search?q=" + encodedKeyword;
                    break;
                case 'baidu':
                    searchUrl = "https://www.baidu.com/s?wd=" + encodedKeyword;
                    break;
                case 'sogou':
                    searchUrl = "https://www.sogou.com/web?query=" + encodedKeyword;
                    break;
                case 'so':
                    searchUrl = "https://www.so.com/s?q=" + encodedKeyword;
                    break;
                default:
                    alert("请选择一个搜索引擎。");
                    return;
            }

            window.open(searchUrl, "_blank");
        }
    </script>
</head>
<body>
    <h1>选择搜索引擎进行搜索</h1>
    <label for="keyword">输入关键词:</label>
    <input type="text" id="keyword" required>
    <label for="engine">选择搜索引擎:</label>
    <select id="engine">
        <option value="bing">Bing</option>
        <option value="baidu">Baidu</option>
        <option value="sogou">Sogou</option>
        <option value="so">So.com</option>
    </select>
    <button onclick="searchSelectedEngine()">搜索</button>
</body>
</html>

相关文章:

  • 在vs+QT中使用QT的库(multimedia.lib)
  • 009 批量删除
  • Linux(面试篇)
  • 虚拟机安装centos7-桥接模式
  • ChatGPT 3.5/4.0简单使用手册
  • 全感知、全覆盖、全智能的名厨亮灶开源了
  • Java SpringBoot+Vue实战教程:如何搭建高中素质评价档案系统?
  • R语言管道操作详解-高效编程
  • 为什么要构建自己的 AI 代理库
  • [医疗 AI ] 3D TransUNet:通过 Vision Transformer 推进医学图像分割
  • Aiseesoft Mac Video Converter Ultimate:高效多能的视频转换与编辑工具
  • Qt之控件介绍
  • 柔性数组
  • TCP的连接建立及报文段首部格式
  • Redis复制
  • FPGA工程师成长路线(持续更新ing,欢迎补充)
  • git cherry-pick 合并多个提交
  • Linux系统性能调优详细讲解和案例示范
  • 数据结构-队列
  • Unity动画模块 之 动画层混合
  • 广州比较有名的网站建设公司/网络推广是干嘛的
  • 做企业福利网站起名/免费域名解析
  • 网站必须做诚信认证吗/企业seo网络推广
  • 高端女装/北京百度推广排名优化
  • wordpress 不能查看站点/免费推广网站2023mmm
  • 美国白宫网站开发/绍兴seo排名收费