css闪动效果 ----样式发生快速的变化

时间:2014-05-01 13:09:05   收藏:0   阅读:786
mamicode.com,码迷
<!DOCTYPE >
<html>
    <head>
        <title>JS+CSS做文字闪烁</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <style>
            .wa{
                font-size:13px;  
                color: #0000FF;  
            }
            .wa2{
                font-size:13px;  
                color: #FFFF00; 
            }
            .sty1{
                display: block;    
            }
            .sty2{
                display: none;    
            }
         </style>
    </head>
    <body>
         <span class="wa" id="shan">北京青年</span>
         <div class="sty1" id="pic">
             <img src="../img/girl.jpg" />
         </div>
         <script type="text/javascript">
             function change(){
                 var ss = document.getElementById("shan");
                 if(ss.className == "wa"){
                     ss.className = "wa2";
                 }else{
                     ss.className = "wa";
                 }
                 setTimeout("change()",100);
             }
             change();
             picChange();
             function picChange(){
                 var pic = document.getElementById("pic");
                 if(pic.className == "sty1"){
                     pic.className = "sty2";
                 }else {
                     pic.className = "sty1";
                 }
                 setTimeout("picChange()",50);
             }
         </script>
    </body>
</html>
mamicode.com,码迷

 

css闪动效果 ----样式发生快速的变化,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!