• 近期在看的一段JS(谁能看出我想实现什么功能)


    示例代码:

    <script type="text/javascript">
    !function(){
        var e=/([http|https]://[a-zA-Z0-9\_.]+.baidu.com)/gi,
        r=window.location.href,
        o=document.referrer;
        // console.log(e);
        // console.log(r);
        // console.log(o);
        if(!e.test(r)){ // 为了防止 这个网址是百度自家的产品
            // console.log('a');
            var n="//api.share.baidu.com/s.gif";
            o?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);
            var t=new Image;
            t.src=n;
            console.log(t);
        };
        // if(!e.test('http://www.baidu.com/')){
        //     console.log('a');
        // }else{
        //     console.log('b');
        // };
    }(window);
    </script>

    深入探讨:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    </head>
    <body>
    <a href="http://127.0.0.1/1/1.html">3.html</a>
    <a href="http://127.0.0.1/1/2.html">2.html</a>
    <a href="http://127.0.0.1/1/3.html">1.html</a>
    <a href="http://127.0.0.1/1/4.html">2.html</a> 
    <a href="http://127.0.0.1/1/5.html">1.html</a>
    <a href="http://127.0.0.1/1/6.html">2.html</a> 
    <a href="http://127.0.0.1/1/7.html">2.html</a> 
    <a href="http://127.0.0.1/1/8.html">2.html</a> 
    <a href="http://127.0.0.1/1/9.html">2.html</a> 
    <a href="http://127.0.0.1/1/10.html">2.html</a> 
    <a href="http://127.0.0.1/1/11.html">2.html</a> 
    <a href="http://127.0.0.1/1/12.html">2.html</a> 
    <a href="http://127.0.0.1/1/13.html">2.html</a> 
    <a href="http://127.0.0.1/1/14.html">2.html</a> 
    <a href="http://127.0.0.1/1/15.html">2.html</a> 
    <a href="http://127.0.0.1/1/16.html">2.html</a> 
    <a href="http://127.0.0.1/1/17.html">2.html</a> 
    <a href="http://127.0.0.1/1/18.html">2.html</a> 
    <a href="http://127.0.0.1/1/19.html">2.html</a> 
    <a href="http://127.0.0.1/1/20.html">2.html</a>
    </body>
    <script type="text/javascript">
    var list = document.getElementsByTagName("a");
    var n = "//api.share.baidu.com/s.gif";
    var r = window.location.href;
    var url = [];
    for(var i=0;i<list.length;++i){
        url.push(n+'?r='+encodeURIComponent(list[i].href)+'&l='+r);
    };
    for(var i=0;i<5;++i){
        var t = new Image;
        t.src = url[Math.round(Math.random() * list.length)];
    }; 
    
    // var m = Math.round(Math.random() * list.length);
    // api.share.baidu.com/s.gif?r=http%3A%2F%2F127.0.0.1%2F1%2F3.html&l=http://127.0.0.1/1/3.html
    // api.share.baidu.com/s.gif?r=http%3A%2F%2F127.0.0.1%2F1%2F3.html&l=http://127.0.0.1/2.html
    </script>
    </html>

    谁能看出我想要实现什么功能。

  • 相关阅读:
    Mac部署hadoop3.2.1(伪分布式) ,Hadoop自带的MapReduce程序(wordcount),,,,安装scala,hadoop安装启动问题,Pyspark开发环境搭建,MAC Spark安装和环境变量设置
    使用objdump objcopy查看与修改符号表
    alias, bg, bind, break, builtin, caller, cd, command,
    virtualbox端口转发
    CMake快速入门教程-实战
    内存管理
    http调试工具,linux调试工具
    CSS Background
    RadioButton的check改变的时候
    Docs-->.NET-->API reference-->System.​Web.​UI.​Web​Controls-->Repeater
  • 原文地址:https://www.cnblogs.com/e0yu/p/9992578.html
Copyright © 2020-2023  润新知