OSChina年度热门第二的代码赏析

作者:

在

image

<
html
>
<
head
>
<
title
>DZ新闻中心----DZ是世界上最牛的人!</
title
>

<
script type
="text/javascript"
>
    var str = ["D","Z","新","闻","中","心","----","D","Z","是","世","界","上","最","牛","的","人","!"," "," "," "];
var len = str.length;

var index = 0;
function rollTitle(){
    var title = "";
    if(index == len){
        index = 0;
    }else{
        index ++;
    }
    for(var i = 0; i < len; ++i){
        var j = i + index;
        if(j >= len){
            title += str[j - len];
        }else{
            title += str[j];
        }
    }
    document.getElementsByTagName("title")[0].innerText=title;

    setTimeout(rollTitle,500);
}

(function(){    
    setTimeout(rollTitle,500);
}());
</
script
>

<
style
>
    p{
        padding-left:20px;
        font-size:35px;
    }
    A{
        COLOR:BLUE;
        text-decoration:none;
    }
</
style
>

</
head
>

<
body
>
<
p
>
    <
a target
="_blank" href
="http://news.baidu.com/"
>百度新闻</
a
>
</
p
>
<
p
>
    <
a target
="_blank" href
="http://www.sina.com.cn/"
>新浪门户</
a
>
    <
a target
="_blank" href
="http://news.sina.com.cn/"
>新浪新闻</
a
>
</
p
>
<
p
>
    <
a target
="_blank" href
="http://www.qq.com/"
>腾讯门户</
a
>    
    <
a target
="_blank" href
="http://news.qq.com/"
>腾讯新闻</
a
>
</
p
>
<
p
>
    <
a target
="_blank" href
="http://cn.msn.com/"
>MSN资讯</
a
>
</
p
>
<
p
>
    <
a target
="_blank" href
="http://www.ifeng.com/"
>凤凰网</
a
>
    <
a target
="_blank" href
="http://news.ifeng.com/"
>凤凰资讯</
a
>    
</
p
>
<
p
>
<
a target
="_blank" href
="http://www.chinanews.com/"
>中国新闻网</
a
>
</
p
>
<
p
>
<
a target
="_blank" href
="http://www.huanqiu.com/"
>环球网</
a
>
</
p
>
</
body
>

</
html
>
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

欣赏评论:KAO

评论

发表回复