<!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> </body> </html>
小白一枚,上面的东西,参考了jquery ui的东西写的。
点击编辑按钮,弹出窗口,窗口是表单信息,name+id。 更改name 或id, 保存。
点击删除按钮,删除当前行的信息。
添加功能已完善。编辑和删除信息,小白不知道怎么获取? 望各位大师帮帮忙,在线等。。
首先,要从你的后端程序(asp,php,java,python,ruby....)里面做出相应的功能。
then,在用JS实现AJAX来异步提交你的操作,待后端程序做出响应之后再修改前端的东西。