JS改变文字透明度

javascript改变文字透明度,文字闪烁效果:

<html>
    <head>    
        <style type="text/css">
            .title
            {
                font-size:50px;
                font-family:Arial black;
                filter:alpha(opacity=10);
            }
        </style>
        <script type="text/javascript">
            function $(id)
            {
                return document.getElementById(id);
            };

            function changeOpacity()
            {
                var direction=-1;
                var opacityValue=100;
                function doChange()
                {
                    if(++opacityValue>=100)
                    {
                        direction=-1;
                    }
                    if(--opacityValue<=0)
                    {
                        direction=1;
                    }
                    opacityValue+=direction;
                    $("t1").style.filter="alpha(opacity="+opacityValue+")";
                    $("t1").style.opacity=opacityValue/100;
                };
                setInterval(doChange,10);
                
            };
        </script>
    </head>
    <body onload="changeOpacity()">
        <table id="t1" class="title"><tr><td>Hi,I'm content for text</tr></table>
    </body>
</html>


阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页