zoukankan      html  css  js  c++  java
  • JavaScript后台代码操作HTML TABLE的方法

    var rowNum = 0,fileNum = 0; //行号与列号 
    var oNewRow; //定义插入行对象 
    var oNewCell1,oNewCell2; //定义插入列对象 
    var fileNum = 1; 

    function addFileToTable(strFile) 

    fileNum +=1; 
    rowNum = document.getElementById("NewFileList").rows.length; 
    oNewRow = document.getElementById("NewFileList").insertRow(rowNum); 
    oNewRow.id = "clientRow_" + fileNum; 

    //添加第一列 
    oNewCell1 = document.getElementById("NewFileList").rows[rowNum].insertCell(0); 
    oNewCell1.innerHTML = "<input type='Text' readonly='readonly' style='border:0px;100px;' value='" + getFileName(strFile) + "' />"; 

    //添加第二列 
    oNewCell2 = document.getElementById("NewFileList").rows[rowNum].insertCell(1); 
    oNewCell2.innerHTML ="  <span name=" + fileNum + " style='cursor:hand;color:Red; text-decoration:none; font-family:@HGP?????E;' onClick='DelClientRow(this);' >X</span>"; 
    }

    ASP.NET后台代码操作HTML TABLE的方法  

    例1:该方法是读取服务器上路经为"strFilePath"的文件夹中的所有文件,并显示在页面上ID为"OldFileList"的TABLE中,注意,这个TABLE的"runat=server"。 
    public void ShowFilesIn(string strFilePath) 

    OldFileList.Rows.Clear(); 
    string[] strFileNames = GetFilesInServer(strFilePath); 
    for (int i = 0; i < strFileNames.Length; i++) 

    HtmlTableRow newRow = new HtmlTableRow(); 
    newRow.ID = "serverRow_" + i; 
    HtmlTableCell cell1 = new HtmlTableCell(); 
    HtmlTableCell cell2 = new HtmlTableCell(); 

    cell1.InnerHtml = "<input type='Text' readonly='readonly' style='border:0px;90px;' value='" + strFileNames[i] + "' />"; 
    cell2.InnerHtml = " <span name=" + strFileNames[i] + " style='cursor:hand;color:Red; text-decoration:none; font-family:@HGP?????E;' onClick='DelServerRow(this);' >X</span>"; 
    newRow.Cells.Add(cell1); 
    newRow.Cells.Add(cell2); 
    OldFileList.Rows.Add(newRow); 

    }

  • 相关阅读:
    yum之镜像加速
    MySQL5.7安装
    销售订单的批量审批/反审
    MM06E005 EXIT_SAPMM06E_013 采购订单增强
    直接用代码查找增强Enhancement
    SAP相关业务表
    模拟会计凭证审批 OO ALV(屏幕跳转、定位行数据、审批按钮)
    spark 和 fink
    说说spark
    golang server端的epoll
  • 原文地址:https://www.cnblogs.com/ranran/p/4081770.html
Copyright © 2011-2022 走看看