html——jQuery练习题3

来源:互联网 发布:淘宝港澳台运费设置 编辑:程序博客网 时间:2024/06/06 05:45
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>每间隔2秒修改一个层的显示状态</title>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
                <script type="text/javascript">
                        $(function(){
                                 setInterval(function(){
                                         $("#j1").toggleClass("show");
                                 },2000);
                        });
                </script>
                <style>
                        div{width:200px;height:50px;background: #dfdfef; line-height: 50px; text-align: center;margin: 8px;display: none;}
                        .show{display:block; opacity: 0.8;}
                </style>
        </head>
        <body>
                                <div id="j1">每隔两秒修改层的显示状态</div>
        </body>
</html>