独孤逸辰

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

来自www.Piscean.com

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Piscean</title>
<style type="text/css">
body { font-family: 'Times New Roman'; }
</style>
</head><body>
<h1><span style="color: rgb(255, 128, 0);">P</span><span style="color: rgb(255, 255, 0);">i</span><span style="color: rgb(0, 255, 0);">s</span><span style="color: rgb(0, 255, 255);">c</span><span style="color: rgb(0, 0, 255);">e</span><span style="color: rgb(128, 0, 255);">a</span><span style="color: rgb(255, 0, 0);">n</span></h1>
<p><a href="http://www.piscean.net/blog/">Blog</a> | <a href="http://www.piscean.net/lab/">Lab</a></p>
<script type="text/javascript">
/*
赤 255,0,0 
橙 255,128,0 
黄 255,255,0 
绿 0,255,0 
青 0,255,255 
蓝 0,0,255 
紫 128,0,255 
*/
var cs = ["#ff0000","#ff8000","#ffff00","#00ff00","#00ffff","#0000ff","#8000ff"];
setTimeout(function() {
    var h1 = document.getElementsByTagName("h1")[0];
    var s = "Piscean";
    var a = s.split(""), al = s.length;
    var i, t;
    h1.innerHTML = "";
    for (i = 0; i < al; i++) {
        t = document.createElement("span");
        t.appendChild(document.createTextNode(a[i]));
        h1.appendChild(a[i] = t);
    }
    i = 0;
    setInterval(function() {
        for (var j = 0; j < al; j++){
            a[j].style.color = cs[(i + j) % al];
        }
        if (++i >= al) i = 0;
    }, 500);
}, 0);
</script>
</body></html>


为什么运行框的代码里在

posted on 2010-06-14 22:40  独孤逸辰  阅读(436)  评论(0编辑  收藏  举报