zoukankan      html  css  js  c++  java
  • 节点移动

    <!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>
  • 相关阅读:
    【Luogu P5515】[MtOI2019]灵梦的计算器
    简易的命令行入门教程
    8个接私活的网站,只要你有码,那“我”就有钱
    单表查询必会13条
    「Django」rest_framework学习系列-路由
    Linux下将时间修改为当地时间(通过ntpdate服务)
    iptables拒绝发起大量请求(针对单IP地址)
    .webp格式win7无法显示缩略图
    永久修改/etc/proc下的项的配置文件
    通过vsftpd实现虚拟用户登录,不同的用户登录不同的目录,使用不同的权限
  • 原文地址:https://www.cnblogs.com/cj-18/p/9206871.html
Copyright © 2011-2022 走看看