1.隔行换色

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>隔行换色</title>
        <script src="../js/jquery-3.3.1.min.js"></script>
        <script>
            $(function () {
                $("tr:gt(1):odd").css("backgroundColor","pink");
                $("tr:gt(1):even").css("backgroundColor","yellow")
            })
        </script>
    </head>
    <body>
        <table id="tab1" border="1" width="800" align="center">
            <tr>
                <td colspan="5"><input type="button" value="删除"></td>
            </tr>
            <tr style="background-color: #999999;">
                <th><input type="checkbox"></th>
                <th>分类ID</th>
                <th>分类名称</th>
                <th>分类描述</th>
                <th>操作</th>
            </tr>
            <tr>
                <td><input type="checkbox"></td>
                <td>0</td>
                <td>手机数码</td>
                <td>手机数码类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox"></td>
                <td>1</td>
                <td>电脑办公</td>
                <td>电脑办公类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox"></td>
                <td>2</td>
                <td>鞋靴箱包</td>
                <td>鞋靴箱包类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox"></td>
                <td>3</td>
                <td>家居饰品</td>
                <td>家居饰品类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
        </table>
    </body>
</html>

2.全选和全不选

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="../js/jquery-3.3.1.min.js"></script>
        <script>
            $(function () {

            })
            function selectAll(obj) {
                $(".itemSelect").prop("checked",obj.checked)
            }
        </script>
    </head>
    <body>
        <table id="tab1" border="1" width="800" align="center" >
            <tr>
                <td colspan="5"><input type="button" value="删除"></td>
            </tr>
            <tr>
                <th><input type="checkbox" onclick="selectAll(this)" ></th>
                <th>分类ID</th>
                <th>分类名称</th>
                <th>分类描述</th>
                <th>操作</th>
            </tr>
            <tr>
                <td><input type="checkbox" class="itemSelect"></td>
                <td>1</td>
                <td>手机数码</td>
                <td>手机数码类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox" class="itemSelect"></td>
                <td>2</td>
                <td>电脑办公</td>
                <td>电脑办公类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox" class="itemSelect"></td>
                <td>3</td>
                <td>鞋靴箱包</td>
                <td>鞋靴箱包类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
            <tr>
                <td><input type="checkbox" class="itemSelect"></td>
                <td>4</td>
                <td>家居饰品</td>
                <td>家居饰品类商品</td>
                <td><a href="">修改</a>|<a href="">删除</a></td>
            </tr>
        </table>
    </body>
</html>

3.表情包选择

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title>QQ表情选择</title>
        <script src="../js/jquery-3.3.1.min.js"></script>
        <style type="text/css">
            * {
                margin: 0;
                padding: 0;
                list-style: none;
            }

            .emoji {
                margin: 50px;
            }

            ul {
                overflow: hidden;
            }

            li {
                float: left;
                width: 48px;
                height: 48px;
                cursor: pointer;
            }

            .emoji img {
                cursor: pointer;
            }
        </style>
        <script>
            $(function () {
                $("ul li img").click(function () {
                    $(".word").append($(this).clone())
                })
            })
        </script>
    </head>
    <body>
        <div class="emoji">
            <ul>
                <li><img src="img/01.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/02.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/03.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/04.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/05.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/06.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/07.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/08.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/09.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/10.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/11.gif" height="22" width="22" alt=""/></li>
                <li><img src="img/12.gif" height="22" width="22" alt=""/></li>
            </ul>
            <p class="word">
                <strong>请发言:</strong>
                <img src="img/12.gif" height="22" width="22" alt=""/>
            </p>
        </div>
    </body>
</html>

4.左右移动

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="../js/jquery-3.3.1.min.js"></script>
        <style>
            #leftName, #btn, #rightName {
                float: left;
                width: 100px;
                height: 300px;
            }

            #toRight, #toLeft {
                margin-top: 100px;
                margin-left: 30px;
                width: 50px;
            }

            .border {
                height: 500px;
                padding: 100px;
            }
        </style>
        <script>
            $(function () {
                $("#toRight").click(function () {
                    $("#rightName").append($("#leftName > option:selected"))
                });
                $("#toLeft").click(function () {
                    $("#leftName").append($("#rightName > option:selected"))
                })
            })
        </script>
    </head>
    <body>
        <div class="border">
            <select id="leftName" multiple="multiple">
                <option>张三</option>
                <option>李四</option>
                <option>王五</option>
                <option>赵六</option>
            </select>
            <div id="btn">
                <input type="button" id="toRight" value="-->"><br>
                <input type="button" id="toLeft" value="<--">
            </div>
            <select id="rightName" multiple="multiple">
                <option>钱七</option>
            </select>
        </div>
    </body>
</html>
Last modification:September 9th, 2020 at 05:49 pm
如果觉得我的文章对你有用,请随意赞赏