三种百度站内搜索代码【转载】

版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!


恰饭广告




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <form action="https://www.baidu.com/s">
       <input type="submit" value="Baidu 搜索">
       <input name="ie" type="hidden" value="utf-8">
       <input name="f" type="hidden" value="8">
       <input name="rsv_bp" type="hidden" value="1">
       <input name="rsv_idx" type="hidden" value="1">
       <input name="tn" type="hidden" value="baidu">
       <input type="text" name="wd">
   </form>
</body>
</html>

注意:代码来源:(http://www.williamlong.info/archives/447.html

<form onsubmit="return baiduWithHttps(this)" action="http://www.baidu.com/baidu" target="_blank">
    <input name="tn" type="hidden" value="SE_zzsearchcode_shhzc78w">
    <a href="https://www.baidu.com/" target="_blank">
        <img src="https://www.baidu.com/img/baidu_jgylogo3.gif" alt="Baidu" align="bottom" border="0">
    </a>
    <input type="text"  onfocus="checkHttps" name="word"  size="30">
    <input type="submit"value="百度搜索">
</form>
<script src="http://s1.bdstatic.com/r/www/cache/global/js/BaiduHttps_20150714_zhanzhang.js"></script>
<script>
    function checkHttps () {
        BaiduHttps.useHttps();
    };
    function baiduWithHttps (formname) {
        var data = BaiduHttps.useHttps();
        if (data.s === 0) {
            return true;
        }
        else {
            formname.action = 'https://www.baidu.com/baidu' + '?ssl_s=1&ssl_c' + data.ssl_code;
            return true;
        }
    };
</script> 

注意:代码来源(https://www.baidu.com/code.html

<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body ng-controller="show">
    <div id="wei">
        <input type="text" id="text">
        <ul id="list"></ul>
   </div>
    <script type="text/javascript">
        var txt = document.getElementById("text");
        var oUl = document.getElementById("list");
        txt.onkeyup = function() {
                var val = txt.value;
                var oScript = document.createElement("script"); //动态创建script标签
                oScript.src = "https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=" + val + "&cb=callback";
                //添加链接及回调函数
                document.body.appendChild(oScript); //添加script标签
                document.body.removeChild(oScript); //删除script标签
            }
            //回调函数
        function callback(data) {
            var str = "";
            for (var i = 0; i < data.s.length; i++) {
                str += "<li><a href=\"https://www.baidu.com/s?wd=" + data.s[i] + "\">" + data.s[i] + "</a></li>";
            }
            //console.log(str);
            oUl.innerHTML = str;
            oUl.style.display = "block";
        }
    </script>
</body>
</html>  

原文链接:https://www.idaobin.com/archives/258.html

让我恰个饭吧.ヘ( ̄ω ̄ヘ)

支付宝 ——————- 微信
图片加载中图片加载中



恰饭广告

发表评论

邮箱地址不会被公开。 必填项已用*标注

9 + 1 =