當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
近期在看的一段JS(谁能看出我想实现什么功能)
生活随笔
收集整理的這篇文章主要介紹了
近期在看的一段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>誰能看出我想要實現什么功能。
轉載于:https://www.cnblogs.com/e0yu/p/9992578.html
總結
以上是生活随笔為你收集整理的近期在看的一段JS(谁能看出我想实现什么功能)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在图书馆学习红宝书的一天(二)· 慢慢看
- 下一篇: 通过SSH克隆远程仓库(GitLab)到