1 Star 0 Fork 0

JqueryObjects/jsonpbaidu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

跨域访问百度jsonpbaidu

效果如下:

all code:

<!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>

空文件

简介

取消

发行版

暂无发行版

贡献者 (1)

全部

近期动态

6年前创建了仓库
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/JqueryObjects/jsonpbaidu.git
git@gitee.com:JqueryObjects/jsonpbaidu.git
JqueryObjects
jsonpbaidu
jsonpbaidu
master

搜索帮助