`
tanglei198577
  • 浏览: 57905 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

Add or delete lines of table by JS

阅读更多

When want to add a line or delete a line for detailed info for basic object ,we can use this:

function deleteRow(tableObjStr,saveNumber){
    var tableObj = document.getElementById(tableObjStr);
    var rowNum   = tableObj.rows.length-1;
    var count = 0;
    if(rowNum==1)  return alert("Cannot delete anymore!");
    for(var i=document.zzjcdForm.checkbox.length-1;i>=1;i--)
    {
      if(document.zzjcdForm.checkbox[i].checked)
      {
        count++;
        tableObj.deleteRow(i+1); 
       }
    }
     if(count==0)alert("Pls select the line u want to delete !");       
}

// add a line
function addRow(tableObjStr,tr0,trIdPrefix){
var tableObj = document.getElementById(tableObjStr);
var trNode     = document.getElementById(tr0);
var trObj    = trNode.cloneNode(true);
var rowNum   = eval(tableObj.lastChild.lastChild.id.substring(tableObj.lastChild.lastChild.id.indexOf(trIdPrefix)+trIdPrefix.length));
tableObj.lastChild.appendChild(trObj);
tableObj.lastChild.lastChild.id=trIdPrefix+(rowNum+1);
tableObj.lastChild.lastChild.style.display=""; 
}

 

分享到:
评论

相关推荐

    ImageMagick图片批量处理

    -endian type endianness (MSB or LSB) of the image -family name render text with this font family -fill color color to use when filling a graphic primitive -filter type use this filter when ...

    Knockout API 中文版

    Just represent your items as a JavaScript array, and then use a foreach binding to transform this array into a TABLE or set of DIVs. Whenever the array changes, the UI changes to match (you don’t ...

    WPTools.v6.29.1.Pro

    - fix of problem with table borders when also PageMirror was used. * change to DeleteMarkedChar. It now has additional parameter DeleteEmptyParAndTables : Boolean * change in unit WPWordConv to handle...

    apktool documentation

    They are usually named with the naming of "resources", "res" or "framework". Example HTC has a framework called com.htc.resources.apk, LG has one called lge-res.apk After you find a framework file...

    Radmin自动登录器v3.0-多国语言绿色版-Release1-20150615

    * Delete :删除记录或目录(在记录窗格),或删除树状目录(在目录树窗格); * F1 :显示程序信息; * F2 :更名树状目录; * F3 :单条扫描(等待5秒,用于扫描网速较慢的记录); * F5 :全部扫描(多线程同时扫描...

    Radmin自动登录器v3.0

    * Delete :删除记录或目录(在记录窗格),或删除树状目录(在目录树窗格); * F1 :显示程序信息; * F2 :更名树状目录; * F3 :单条扫描(等待5秒,用于扫描网速较慢的记录); * F5 :全部扫描(多线程同时扫描...

    cuteEditor6.0

    Apply security to control user access to resources <br/>Cute Editor allows developers to assign a pre-defined set of permissions by group or individual. This prevents a normal user ...

    mysql数据库的基本操作语法

    alter table student add foreign key(classes_name, classes_number) referencesclasses(name, number); 自引用、自关联(递归表、树状表) create table tree( id int auto_increment primary key, name varchar...

    MS-DOS 5.0

    If you have a partition created by WYSE DOS 2.11 or 3.1, you must delete the DOS partitions from your hard disk. See the procedure for repartitioning hard disks in Chapter 4 of the Microsoft MS-DOS ...

    FastReport.v4.15 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版支持D4-XE5

    - fixed output of the check boxes on the highlighted lines in PDF export - fixed bug with PDF anchors - fixed bug when using two or more macroses in memo version 4.12 --------------- + added support ...

    VB编程资源大全(英文源码 其它)

    rectangular or spherical gradient texts."<END><br>13 , sweepgl.zip This example greatly demonstrates how to use OpenGL in Visual Basic.<END><br>15 , drawdemo.zip This is an excellent example of ...

    GIT2.33.0.2最新版本.zip

    * Preliminary clean-up of tests before the main reftable changes hits the codebase. * The backend for "diff -G/-S" has been updated to use pcre2 engine when available. * Use ".DELETE_ON_ERROR" ...

    BURNINTEST--硬件检测工具

    to prevent any toggling of these lines. Previously these where enabled, but not explicitly toggled. Release 5.3 build 1026 WIN32 release 17 July 2008 - Updated Level 2 and Level 3 CPU cache ...

    unigui0.83.5.820

    - 0000689: CustomFiles property for ServerModule to add custom CSS and JS files - 0000688: Bug in installer Environment setter - 0000687: "Script" property for TUniForm for adding Custom JS - 0000665...

    8-07-14_MegaCLI for linux_windows

    SCGCQ00343310 Defect MegaCLI "adpBIOS dsply" command does not display correct information when set to BE or SOE SCGCQ00344574 Defect MegaCLI does not prompt user to reboot after update firmware SCGCQ...

    arcgis工具

    与Are crossed by the outline of类似,但是该方法可以选择与参照要素接连的要素。例如,选择与道路相交的荒地,选择的结果将包括该道路在其边界范围之内或在其边界之上的所有荒地。 在…距离范围内(Are within a...

    DebuggingWithGDB 6.8-2008

    Table of Contents Summary of gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    Basic4Android 初學者指南 英文版

    4.2.10 Highlighting occurences of words .......................................................................... 61 4.2.11 Debugging ....................................................................

Global site tag (gtag.js) - Google Analytics