如题:如何使用JS使多行文字有闪烁效果<td><span id="t">1</span></td>
<td><span id="t">2</span></td>
<td><span id="t">3</span></td>如何使id=t的文字上有闪烁的效果
我自己在网上看了一下,很多只能是一行闪烁,其他行就没效果了

解决方案 »

  1.   

    Google一下,很多<HTML>
    <HEAD>
    <meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "><SCRIPT>
    function   blink   (elId)   {
        var   html   =   ' ';
        if   (document.all)
            html   +=   'var   el   =   document.all. '   +   elId   +   '; ';
        else   if   (document.getElementById)
            html   +=   'var   el   =   document.getElementById( " '   +   elId   +   ' "); ';
        html   +=  
            'el.style.visibility   =   '   +  
            'el.style.visibility   ==   "hidden "   ?   "visible "   :   "hidden " ';
        if   (document.all   ||   document.getElementById)
            setInterval(html,   500)
    }
    function   init   ()   {
        blink( 'aText ');
        blink( 'a2ndText ');
    }
    </SCRIPT>
    </HEAD>
    <BODY   ONLOAD= "init(); ">
    <SPAN   ID= "aText "> <BLINK> 这行文字闪烁!!! </BLINK> </SPAN> 文字闪烁例子!!! <DIV   ID= "a2ndText "> 这行文字闪烁!!! </DIV>
    </BODY>
    </HTML> 
      

  2.   

    <td><span id="t1">1</span></td>
    <td><span id="t2">2</span></td>
    <td><span id="t3">3</span></td>
    <script type="text/javascript">
    var timer = "";
    onload = function(){
    objs  = document.getElementsByTagName("span");
    changeColor();
    }

    function changeColor(){
    clearInterval(timer);
    for(var i=0; i< objs.length; i++){
    objs[i].style.background = "#" + parseInt(Math.random()*256).toString(16) + parseInt(Math.random()*256).toString(16) + parseInt(Math.random()*256).toString(16);
    }
    timer = setInterval(changeColor, 1000);
    }
    </script>
      

  3.   

    说得不是很准确
    应该是
    <td><span id="t1">1</span></td>
    <td><span id="t1">2</span></td>
    <td><span id="t1">3</span></td>
    <td><span id="t2">4</span></td>
    <td><span id="t2">5</span></td>
    id=t1 BLUE和RED 交替闪烁
    id=t2 BLUE和GREEN交替闪烁