• 节点移动


    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            select {
                 100px;
                height: 150px;
            }
    
            form {
                display: flex;
            }
    
            div {
                 40px;
            }
        </style>
    </head>
    
    <body>
        <form action="#" method="get">
            <select name="" id="name" multiple>
                <option value="zgl">诸葛亮</option>
                <option value="zf">张飞</option>
                <option value="gy">关羽</option>
                <option value="xc">许褚</option>
                <option value="lb">刘备</option>
                <option value="cc">曹操</option>
            </select>
            <div>
                <input type="button" value="&gt;">
                <input type="button" value="&gt;&gt;">
                <input type="button" value="&lt;">
                <input type="button" value="&lt;&lt;">
            </div>
            <select name="" id="changeName" multiple>
    
            </select>
            <div>
                <input type="button" value="↑">
                <input type="button" value="↓">
            </div>
        </form>
        <script src="./jquery-1.12.4.min.js"></script>
        <script>
            window.onload = function name(params) {
            //向右移动选中的项 $(
    "input[value='>']").click(function () { $("select option:selected").appendTo("#changeName"); })
            //向右移动所有项 $(
    "input[value='>>']").click(function () { $("select option").appendTo("#changeName"); })
        
           //向左移动选中的项
                $("input[value='<']").click(function () {
                    $("#changeName>option:selected").appendTo("#name");
                })
             //向左移动所有项 $(
    "input[value='<<']").click(function () { $("#changeName option").appendTo("#name"); })
            //上移 $(
    "input[value = '↑']").click(function () { $("#changeName option:selected:first").prev().before($("#changeName option:selected")) $("#name option:selected:first").prev().before($("#name option:selected")) })
            //下移 $(
    "input[value = '↓']").click(function () { $("#name option:selected:last").next().after($("#name option:selected")) $("#changeName option:selected:last").next().after($("#changeName option:selected")) }) } </script> </body> </html>
  • 相关阅读:
    PostgreSQL与MySQL常用命令比较
    honghe
    Linux中find命令path prune用法详解
    推荐几种在网页中播放FLV文件的代码
    Html文件转换为Aspx文件后发现样式丢失或失效
    友情链接对PR值的贡献表
    decimal(numeric )、float 和 real 数据类型的区别[转]
    HttpHandle
    一个Ext2+SWFUpload做的图片上传对话框收藏
    IE浏览器无法查看源文件原因及应用技巧
  • 原文地址:https://www.cnblogs.com/cj-18/p/9206871.html
Copyright © 2020-2023  润新知