Ai
1 Star 0 Fork 0

JqueryObjects/jsonpbaidu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 2.97 KB
一键复制 编辑 原始数据 按行查看 历史
涎涎 提交于 2017-08-07 14:41 +08:00 . Add files via upload
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.soutu-btn{
z-index: 1;
position: absolute;
right: 34%;
top: 50%;
margin-top: -30px;
height: 16px;
width: 18px;
background: #fff url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_679c15cc.png) no-repeat;
background-image: -webkit-image-set(url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_679c15cc.png) 1x,url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_x2_0d93badf.png) 2x);
background-image: -moz-image-set(url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_679c15cc.png) 1x,url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_x2_0d93badf.png) 2x);
background-image: -o-image-set(url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_679c15cc.png) 1x,url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_x2_0d93badf.png) 2x);
background-image: -ms-image-set(url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_679c15cc.png) 1x,url(https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/soutu/img/camera_new_x2_0d93badf.png) 2x);
cursor: pointer;
}
input{width:600px;height:30px;border:1px solid blue;margin-top:100px;margin-left:300px;}
li{list-style:none;background:lightgoldenrodyellow ;width:600px;height:30px;display:none;}
ul{margin-left:260px;}
.aa{display:block;}
</style>
</head>
<body>
<span class="soutu-btn"></span>
<input type="text">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
<script src="jquery.js "></script>
<script>
$(function(){
$("input").keyup(function(){
$.ajax({
type:"get",
data:"wd="+$(this).val(),
dataType:"jsonP",
url:"http://suggestion.baidu.com/su",
success:function(data){
}
});
});
});
var baidu={
sug:function(data){
for(var i=0;i<10;i++){
document.getElementsByTagName ("li")[i].setAttribute("class","aa");
document.getElementsByTagName ("li")[i].innerText =data.s[i];
if($("input").val().length>8||$("input").val().length==0){
$("li").removeAttr("class")
}
}
}
}
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/JqueryObjects/jsonpbaidu.git
git@gitee.com:JqueryObjects/jsonpbaidu.git
JqueryObjects
jsonpbaidu
jsonpbaidu
master

搜索帮助