马上注册,免费下载更多dz插件网资源。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我让ai写了一个,记得那时候满大街都是这种源码。。哈哈
- <!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>一起搜</title> <style> body { font-family: "Microsoft YaHei", sans-serif; background-color: #f5f5f5; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; } .container { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 90%; max-width: 600px; text-align: center; } h1 { font-size: 32px; color: #2c3e50; margin-bottom: 20px; } #searchInput { width: 100%; padding: 12px 20px; font-size: 16px; border: 1px solid #ccc; border-radius: 24px; box-sizing: border-box; outline: none; margin-bottom: 20px; } .engine-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 10px; } .engine-btn { padding: 8px 16px; font-size: 14px; border: 1px solid #ddd; background: #f9f9f9; border-radius: 20px; cursor: pointer; transition: all 0.2s; } .engine-btn:hover, .engine-btn.active { background: #e0e0e0; border-color: #bbb; } #searchButton { margin-top: 15px; padding: 10px 24px; font-size: 16px; background: #4285f4; color: white; border: none; border-radius: 24px; cursor: pointer; transition: background 0.3s; } #searchButton:hover { background: #3367d6; } </style></head><body> <div class="container"> <h1>一起搜</h1> <input type="text" id="searchInput" placeholder="请输入搜索关键词" autofocus> <div class="engine-list"> <div class="engine-btn active" data-engine="baidu">百度</div> <div class="engine-btn" data-engine="sogou">搜狗</div> <div class="engine-btn" data-engine="bing">必应</div> <div class="engine-btn" data-engine="google">谷歌</div> </div> <button id="searchButton">搜索</button> </div> <script> let selectedEngine = 'baidu'; document.querySelectorAll('.engine-btn').forEach(btn => { btn.addEventListener('click', () => { document.querySelectorAll('.engine-btn').forEach(b => b.classList.remove('active')); btn.classList.add('active'); selectedEngine = btn.dataset.engine; }); }); document.getElementById('searchButton').addEventListener('click', performSearch); document.getElementById('searchInput').addEventListener('keypress', (e) => { if (e.key === 'Enter') performSearch(); }); function performSearch() { const keyword = document.getElementById('searchInput').value.trim(); if (!keyword) { alert('请输入搜索关键词'); return; } const engines = { baidu: `https://www.baidu.com/s?wd=${encodeURIComponent(keyword)}`, sogou: `https://www.sogou.com/web?query=${encodeURIComponent(keyword)}`, bing: `https://www.bing.com/search?q=${encodeURIComponent(keyword)}`, google: `https://www.google.com/search?q=${encodeURIComponent(keyword)}` }; const url = engines[selectedEngine]; if (url) { window.open(url, '_blank'); } } </script></body></html>
复制代码
©DZ插件网所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。 本站内容为站长个人技术研究记录或网络,不提供用户交互功能,所有内容版权归原作者所有。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,得到更好的正版服务。 您在本站任何的赞助购买、下载、查阅、回复等行为等均表示接受并同意签订《DZ插件网免责声明协议》。 如有侵权请邮件与我们联系处理: discuzaddons@vip.qq.com 并出示相关证明以便删除。敬请谅解!
|