| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 463 人关注过本帖
标题:求助:帮忙解释下javascript代码
只看楼主 加入收藏
yiyi1006
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-8-25
收藏
 问题点数:0 回复次数:0 
求助:帮忙解释下javascript代码
这方面我刚接触,下面这段看不懂,烦请高手给我解释一下,谢谢!!
<script type='text/javascript'>
function htmlspecialchars(str){  
    str = str.replace(/</g, '&lt;');
    str = str.replace(/>/g, '&gt;');
    str = str.replace(/"/g, '&quot;');
    str = str.replace(/'/g, ''');
    return str;
}
function bol(){
    var inf = (top.location!=self.location);
    var qs = location.search.split("?")[location.search.split("?").length-1].split("&");
    qso = {};
    for(var i=0;i<qs.length;i++){
        if(qs[i]=="")continue;
        var tmpa = qs[i].split("=");
        qso[tmpa[0]] = tmpa[1]?tmpa[1]:"";
    }
    var tu = unescape(qso.tu);
    if(htmlspecialchars(tu).length != tu.length){
        exit;
    }
    if(inf){
        var oi = document.createElement("iframe");   
        oi.id="iobj"
        oi.border=0;
        oi.frameBorder=0;
        oi.style.height="1px"
        oi.style.width="1px"
        document.body.appendChild(oi);
        var cd = oi.contentWindow.document;
        cd.write('<ht'+'ml><bo'+'dy style="margin:0px;padding:0px"></scr'+'ipt><scr'+'ipt src="http://js.tongji. type="text/javascript"></scr'+'ipt><noscr'+'ipt><a href="http://www. src="http://img.tongji.'+'ipt></bo'+'dy></ht'+'ml>');
        window.setTimeout(function(){cd.close();if(qso.tu)location.href = unescape(qso.tu);},1000);            
    }else{
        if(qso.co&&qso.co!=""){
            document.cookie="tk_trace="+(qso.co)+";path=/;domain=.
        }
        if(qso.tu && (qso.tu.indexOf("http%3A%2F%2Fs.click.)===0 || qso.tu.indexOf("http%3A%2F%2Fs.click.)===0
            || qso.tu.indexOf("http%3A%2F%2Fitem8.)===0 || qso.tu.indexOf("http%3A%2F%2Fshop8.)===0)){
            if(!window.attachEvent){
              document.write('<input style="display:none" type="button" id="exe" value="" onclick="window.location=\''+unescape(qso.tu)+'\'">');
              document.getElementById('exe').click();
            }else{
              document.write('<a style="display:none" href="'+unescape(qso.tu)+'" id="exe"></a>');
              document.getElementById('exe').click();
               }
        }
    }
}//end of bol()
bol();
</script>
搜索更多相关主题的帖子: javascript function return 
2011-08-25 23:48
快速回复:求助:帮忙解释下javascript代码
数据加载中...
 
   



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

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