熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

js中復制行和刪除行的操作實例

2022-06-13   來源: JSP教程 

  var validateForm = null;
var num = ;
$(document)ready(function(){

var lastCommunAddTr = $("#workDay");

$("#add")click(function() {

//復制一行
var tr = $("#workDay")clone();
trfind("#dayMsg")get()styledisplay="none";
trfind("#remarkMsg")get()styledisplay="none";
trfind("#msg")get()styledisplay="none";
trfind("#day")get()value="";
trfind("#dayMsg")get()id="dayMsg"+num;
trfind("#day")get()id="day"+num;
trfind("#msg")get()id="msg"+num;
trfind("#remark")get()value="春節";
trfind("#state")get()id="state"+num;
trfind("#remark")get()id="remark"+num;
trfind("#remarkMsg")get()id="remarkMsg"+num;
trshow();
trinsertAfter(lastCommunAddTr);
lastCommunAddTr = tr;
num++;

});

//刪除一行
$("#workDayDel")click(function() {
var delIndexs = new Array();

$("trWorkDay:gt()")each(function(i) {

if($(this)find("#ck")get()checked == true){
delIndexssplice(delIndexslengthi);
$(this)remove();
}
$("trWorkDay")each(function() {

lastCommunAddTr = $(this);
});
});
});
});


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19982.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.