[JavaScript]Diamond for your darling

代码不见得是最优的写法,在网速慢的时候可能会有延时,欢迎批评指正:)

 <script language="javascript">
    var count = 1;
    addEvent(window, "load", diamond);
    
    function diamond() {
       setTimeout("setInterval(setImage, 50)",2000);
    }

    function setImage() {
        document.images.diamond.src = "http://images.cnblogs.com/cnblogs_com/justinw/229829/o_dd." + count + ".png";
       count ++;
        if (count  > 15) count  = 1;
    }
</script>

posted @ 2010-03-28 01:48 Justin 阅读(...) 评论(...) 编辑 收藏