<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>我的搜索引擎</title>
<link href="layui/css/layui.css" rel="stylesheet">
<link href="layui/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
cursor: url(img/arrow.gif), default;
}
/** 链接指针样式**/
a:hover{cursor:url(img/link.gif), pointer;}
/** 鼠标样式 结束**/
</style>
</head>
<body >
<ul class="layui-nav layui-bg-gray">
<li class="layui-nav-item"><a href="https://tengyuesj.cn/pansou">首页</a></li>
<li class="layui-nav-item"><a href="https://tengyuesj.cn/">我的博客</a></li>
<!-- <li class="layui-nav-item"><a href="https://tengyuesj.cn/wp-login.php">登录</a></li> -->
<li class="layui-nav-item">
<a href="javascript:;">更多</a>
<dl class="layui-nav-child">
<dd><a href="https://tengyuesj.cn/wp-login.php">登录</a></dd>
</dl>
</li>
<img src="img/busy1.gif" alt="" align="right">
</ul>
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<div id="app" style="color: #8cc851;">
<div class="px-4 py-5 my-5 text-center" :hidden="!(page=='home')">
<h1 class="display-5 fw-bold"><img src="img/busy.gif" alt="">禁忌知识库<img src="img/cross.gif" alt=""></h1>
<div class="col-lg-6 mx-auto" >
<p class="lead mb-4" >
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center" >
<div class="layui-form" >
<select lay-filter="demo-select-filter" >
<option value="https://api.aagtool.top/api/dywsyjx?url=" >抖音</option>
<option value="https://tengyuesj.cn/pansou/index.php?table=zy_baiduxl&keyword=">迅雷</option>
<option value="https://tengyuesj.cn/pansou/index.php?table=zy_baidubd&keyword=">百度</option>
<option value="https://tengyuesj.cn/pansou/index.php?table=zy_baidual&keyword=">阿里</option>
</select>
</div>
<input type="text" class="form-control" name="v" v-model="keyword" placeholder="请输入你要查询的知识" @keyup.enter="search(d_url,true,false)" value="">
<button id="search-button" type="submit" class="btn btn-primary btn-lg">seatch</button>
</div>
</div>
</div>
<img src="img/2.png" alt="" align="right">
<script src="layui/layui.js"></script>
<script>
// 获取选择框、输入框和搜索按钮的元素
var selectElement = document.querySelector('select');
var inputElement = document.querySelector('input');
var searchButton = document.querySelector('button');
// 更新搜索按钮的点击事件处理函数
searchButton.onclick = performSearch;
// 监听输入框的回车键事件
inputElement.addEventListener('keyup', function(event) {
if (event.keyCode === 13) { // 按下回车键
performSearch();
}
});
// 执行搜索的函数
function performSearch() {
// 获取选择的接口URL
var apiUrl = selectElement.value;
// 获取输入的搜索内容
var keyword = inputElement.value;
// 构建完整的搜索URL
var searchUrl = apiUrl + keyword;
// 根据不同的选项值执行不同的js代码
if( apiUrl === "https://api.aagtool.top/api/dywsyjx?url="){
// 执行夸克相关的js代码
console.log("正在选择夸克");
console.log(searchUrl);
} else if(apiUrl === "https://tengyuesj.cn/pansou/index.php?table=zy_baiduxl&keyword="){
// 执行迅雷相关的js代码可以打开控制台看一下
console.log("正在选择迅雷");
console.log(searchUrl);
} else if(apiUrl === "https://tengyuesj.cn/pansou/index.php?table=zy_baidubd&keyword="){
// 执行百度相关的js代码
console.log("正在选择百度");
console.log(searchUrl);
} else if(apiUrl === "https://tengyuesj.cn/pansou/index.php?table=zy_baidual&keyword="){
// 执行阿里相关的js代码
console.log("正在选择阿里");
console.log(searchUrl);
} else {
// 如果选择了其他选项,则执行默认的js代码
console.log("未选择任何选项");
}
}
</script>
</body>
</html>
对不同搜索引擎js处理
发布于 2023-06-03 227 次阅读
Comments NOTHING