网页实现表格的内容更改,删除

<code>产品的添加,删除,</code>

<!doctype html>
<html lang="en">
<head>
    
    <title>jQuery UI Dialog - Modal form</title>
    
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css" />
    <link rel="stylesheet" href="css/jquery-ui.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.js"></script>
    <script src="js/jquery-ui.js"></script>
    <script>
    $(function() {
        var dialog, form,

        nameRegex =/^[\u2E80-\uFE4F]+$/,
        idRegex = /[0-9a-zA-Z]/,
        name = $( "#name" ),
        id = $( "#id" ),
        
        allFields = $( [] ).add( name ).add( id ),
        tips = $( ".validateTips" );

        function updateTips( t ) {
            tips
            .text( t )
            .addClass( "ui-state-highlight" );
            setTimeout(function() {
            tips.removeClass( "ui-state-highlight", 1500 );
            }, 500);
        }

        function checkLength( o, n, min, max ) {
            if ( o.val().length > max || o.val().length " +
                '<input type="checkbox"/>'+
                "" + name.val() + "" +
                "" + id.val() + "" +
                '
 编辑删除
' +
                "" );
                dialog.dialog( "close" );
            }
            return valid;
        }

        function editUser(){
            
        }

        dialog = $( "#dialog-form" ).dialog({
            autoOpen: false,
            // height: 300,
            // width: 350,
            modal: true,
            buttons: {
            "保存": addUser,
            "取消": function() {
            dialog.dialog( "close" );
            }
            },
            close: function() {
            form[ 0 ].reset();
            allFields.removeClass( "ui-state-error" );
            }
        });

        form = dialog.find( "form" ).on( "submit", function( event ) {
            event.preventDefault();
            addUser();
        });

        $( "#create-user" ).on( "click", function() {
            dialog.dialog( "open" );
        });

        $("#editUser").click(function(){
            dialog.dialog("open");
        });
    });
    </script>
</head>
<body>
    

亲友设置

添加亲友

表单内容都是必填选项。

<input type="text" class="form-control" placeholder="亲友昵称" name="name" id="name">
<input type="text" class="form-control" placeholder="id" name="id" id="id">
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">

添加 删除

序号 Name ID 操作
<input type="checkbox"/> 小小红 1234 编辑 删除
<input type="checkbox"/> 小小仔 1234 编辑 删除
<input type="checkbox"/> 小小庆 1234 编辑 删除
</body> </html>

小白一枚,上面的东西,参考了jquery ui的东西写的。
点击编辑按钮,弹出窗口,窗口是表单信息,name+id。 更改name 或id, 保存。
点击删除按钮,删除当前行的信息。
添加功能已完善。编辑和删除信息,小白不知道怎么获取? 望各位大师帮帮忙,在线等。。

阅读 8.9k
2 个回答

首先,要从你的后端程序(asp,php,java,python,ruby....)里面做出相应的功能。
then,在用JS实现AJAX来异步提交你的操作,待后端程序做出响应之后再修改前端的东西。

var row = $(this).parent().parent(); //获取整行

row.remove(); //删除

$(row.children()[1]).text("..."); //修改Name,ID以此类推
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题