您的位置:首页 > Web前端 > JQuery

滑动变色——js和jquery对比

2017-03-09 14:46 239 查看
jQuery方法

<head>

    <script src="jquery-1.4.1.js" type="text/JavaScript"></script>

    <script type="text/javascript">

        $(function () {

            // 不需要on——

            $(".table1 tr").mouseenter(function () {

                $(this).css("backgroundColor", "yellow");

            }).mouseleave(function () {

                $(this).css("backgroundColor", "white");

            });

        })

    </script>

</head>

<body>

    <table class="table1">

        <tr>

            <td>

                喜洋洋

            </td>

        </tr>

        <tr>

            <td>

                喜洋洋

            </td>

        </tr>

        <tr>

            <td>

                喜洋洋

            </td>

        </tr>

        <tr>

      
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: