1.

2.

3.

  1. function ChangeTable()
  2.  
  3. {
  4. var type = document.getElementById("ddl_ReportType").value.Trim();
  5.  
  6. if (type == )
  7. {
  8. document.getElementById("TableInfo").innerHTML = TableYX();
  9. }
  10. else if (type == )
  11. {
  12. document.getElementById("TableInfo").innerHTML = TablePY();
  13. }
  14.  
  15. else if (type == )
  16. {
  17. document.getElementById("TableInfo").innerHTML = TableGL();
  18. }
  19. else if (type == )
  20. {
  21. document.getElementById("TableInfo").innerHTML = TableLG();
  22. }
  23. }
  24.  
  25. function TableGL()
  26. {
  27. var str = "<table name='tblSlt' width='100%' border='0' runat='server' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'>";
  28. str += " <tbody><tr>";
  29.  
  30. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>项目名称</td>";
  31. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>原工资</td>";
  32. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>修改后工资</td>";
  33. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'></td>";
  34.  
  35. str += " </tr></tbody>";
  36. str += " <tr>";
  37. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'>" +
  38. "<select id='SltId' name='SltName' style='width:100%;'> <option value='0' selected='selected'>请选择</option>" +
  39. " <option value='JBGZ_'>工资</option> <option value='BLGZ_'>保留工资</option> <option value='DTF_'>独贴</option> " +
  40. "<option value='MTF_'>民贴</option> <option value='QTY_'>其他</option> <option value='KCBJ_'>扣病事假</option>" +
  41. "<option value='YLJ_'>养老金</option> <option value='YBJ_'>医保金</option> <option value='SBJ_'>失保金</option>" +
  42. "<option value='GJJ_'>公积金</option> <option value='BFGJJ_'>补充公积金</option> <option value='GHF_'>工会费</option>" +
  43. "<option value='QT_'>其他</option> <option value='GTS_'>个调税</option></select> </td>";
  44. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJBGZ' /></td>"; //onchange=\"AllUpdate('JBGZ')\"
  45. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJiangJ' /></td>" //onchange=\"AllUpdate('JiangJ')\"
  46. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;' align='center'><input type='button' style='background:url(../../../images/Button/Button_Change.jpg); width:55px; Height:30px;' onclick =\"AllUpdate('JZZYBF')\" id='JZZYBF' /></td>";
  47.  
  48. str += " </tr> ";
  49. str += "</table>";
  50. return str;
  51. }
  52.  
  53. function TableLG()
  54. {
  55. var str = "<table name='tblSlt' width='100%' border='0' runat='server' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'>";
  56. str += " <tbody><tr>";
  57.  
  58. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>项目名称</td>";
  59. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>原工资</td>";
  60. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>修改后工资</td>";
  61. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'></td>";
  62.  
  63. str += " </tr></tbody>";
  64. str += " <tr>";
  65. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'>" +
  66. "<select id='SltId' name='SltName' style='width:100%;'> <option value='0' selected='selected'>请选择</option> " +
  67. "<option value='JBGZ_'>生活费</option> <option value='FTF_'>社保金</option> " +
  68. " <option value='CTF_'>公积金</option><option value='DTF_'>独贴</option> <option value='MTF_'>民贴</option>" +
  69. "<option value='QTY_'>其他</option> <option value='YLJ_'>养老金</option> <option value='YBJ_'>医保金</option>" +
  70. "<option value='SBJ_'>失业金</option> <option value='GJJ_'>公积金</option> <option value='QT_'>其他</option> </select></td>";
  71. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJBGZ' /></td>";
  72. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJiangJ' /></td>"
  73. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;' align='center'><input type='button' style='background:url(../../../images/Button/Button_Change.jpg); width:55px; Height:30px;' onclick =\"AllUpdate('JZZYBF')\" id='JZZYBF' /></td>"
  74.  
  75. str += " </tr> ";
  76. str += "</table>";
  77. return str;
  78. }
  79.  
  80. function TableYX()
  81. {
  82. var str = "<table name='tblSlt' width='100%' border='0' runat='server' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'>";
  83. str += " <tbody><tr>";
  84.  
  85. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>项目名称</td>";
  86. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>原工资</td>";
  87. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>修改后工资</td>";
  88. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'></td>";
  89.  
  90. str += " </tr></tbody>";
  91. str += " <tr>";
  92. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><select id='SltId' name='SltName' style='width:100%;'>" +
  93. " <option value='0' selected='selected'>请选择</option> <option value='JBGZ_'>工资</option> <option value='BLGZ_'>保留工资</option> " +
  94. " <option value='JiangJ_'>奖金</option> <option value='JZZYBF_'>加、值、中夜班费</option> <option value='DTF_'>独贴</option> " +
  95. "<option value='MTF_'>民贴</option> <option value='FTF_'>饭贴</option> <option value='CTF_'>车贴</option> " +
  96. "<option value='QTY_'>其他一</option> <option value='QTE_'>其他二</option> <option value='KCBJ_'>扣病事假</option> " +
  97. "<option value='YLJ_'>养老金</option> <option value='YBJ_'>医保金</option> <option value='SBJ_'>失保金</option>" +
  98. " <option value='GJJ_'>公积金</option> <option value='BFGJJ_'>补充公积金</option> <option value='GHF_'>工会费</option>" +
  99. "<option value='QT_'>其他</option> <option value='GTS_'>个调税</option> </select></td>";
  100. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJBGZ' /></td>"; //onchange=\"AllUpdate('JBGZ')\"
  101. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJiangJ' /></td>" //onchange=\"AllUpdate('JiangJ')\"
  102. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;' align='center'><input type='button' style='background:url(../../../images/Button/Button_Change.jpg); width:55px; Height:30px;' onclick =\"AllUpdate('JZZYBF')\" id='JZZYBF' /></td>";
  103.  
  104. str += " </tr> ";
  105. str += "</table>";
  106. return str;
  107. }
  108.  
  109. function TablePY() {
  110. var str = "<table name='tblSlt' width='100%' border='0' runat='server' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'>";
  111. str += " <tbody><tr>";
  112.  
  113. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>项目名称</td>";
  114. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>原工资</td>";
  115. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'>修改后工资</td>";
  116. str += " <td class='ListTitle' style='font-weight: bolder;width:50px;' background='../../../images/Main/tableTitle_bg.jpg'></td>";
  117.  
  118. str += " </tr></tbody>";
  119. str += " <tr>";
  120. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'> " +
  121. "<select id='SltId' name='SltName' style='width:100%;'> <option id='selected' value='0' selected='selected'>请选择</option>" +
  122. " <option value='JBGZ_'>工资</option> <option value='JiangJ_'>奖金</option> <option value='JZZYBF_'>加、值、中夜班费</option> " +
  123. "<option value='DTF_'>午餐费</option> <option value='MTF_'>晚餐费</option> <option value='FTF_'>夜宵费</option> " +
  124. " <option value='QTY_'>其他</option> <option value='KCBJ_'>扣病事假</option> <option value='YLJ_'>养老金</option>" +
  125. " <option value='YBJ_'>医保金</option> <option value='SBJ_'>失保金</option> <option value='GJJ_'>公积金</option> " +
  126. "<option value='QT_'>其他</option> <option value='GTS_'>个调税</option> </select></td>";
  127. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJBGZ' /></td>";
  128. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;'><input type='text' maxlength = '12' style='width:100%;' class='tdinput' id='inputJiangJ' /></td>"
  129. str += " <td class='tdColInputCenter' style='font-weight: bolder;width:50px;' align='center'><input type='button' style='background:url(../../../images/Button/Button_Change.jpg); width:55px; Height:30px;' onclick =\"AllUpdate('JZZYBF')\" id='JZZYBF' /></td>";
  130.  
  131. str += " </tr> ";
  132. str += "</table>";
  133. return str;
  134. }
  135.  
  136. function aa()
  137. {
  138. var a = document.getElementById("cc").scrollTop;
  139. var b = document.getElementById("cc").scrollLeft;
  140. document.getElementById("dd").scrollTop = a;
  141. document.getElementById("hh").scrollLeft = b;
  142. }
  143.  
  144. function AllUpdate()
  145. {
  146. var select = document.getElementById("SltId").value;
  147.  
  148. var table = document.getElementById("tblSalaryDetail");
  149.  
  150. var CountNum = ;
  151.  
  152. var NowSal = document.getElementById("inputJBGZ").value.Trim();
  153. var ModifedSal = document.getElementById("inputJiangJ").value.Trim();
  154.  
  155. if (table != null)
  156. {
  157. if (select == "") //默认'请选择'的value值为'0';
  158. {
  159. alert("请选择你需要修改的项目!");
  160. }
  161. else if (NowSal == "" && ModifedSal == "") {
  162. alert("请在对应的位置,输入原工资和修改后的工资!");
  163. }
  164. else if (NowSal == "") {
  165. alert("请输入原工资!");
  166. }
  167. else if (ModifedSal == "") {
  168. alert("请输入修改后的工资!");
  169. }
  170. else
  171. {
  172. //获取表格行数
  173. var tableCount = table.rows.length;
  174.  
  175. for (var row = ; row < tableCount; row++) {
  176. var rowIndex = table.rows[row - ];
  177. var textinput = rowIndex.getElementsByTagName("input");
  178.  
  179. for (var i = ; i < textinput.length; i++) {
  180. if (textinput[i].value == NowSal && (textinput[i].id.indexOf(select) > -)
  181. {
  182. textinput[i].value = ModifedSal;
  183. CountNum++;
  184. }
  185. }
  186. CalculateTotalSalary("", row);
  187. }
  188.  
  189. if (CountNum == ) {
  190. alert("没有找到与你要求相符的数据 ! \n 请您重新输入进行查找。");
  191. }
  192. }
  193. }
  194. else
  195. {
  196. alert("没有可更新的数据!");
  197. }
  198. }

HTML锁定Table中某一列的更多相关文章

  1. JavaScript实现获取table中某一列的值

    JavaScript实现获取table中某一列的值 1.实现源代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ ...

  2. JavaScript获取table中某一列的值的方法

    1.实现源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...

  3. 合并table中某一列相邻的相同的行

    合并table中某一列相邻的相同的行​1. [代码]合并table中某一列相邻的相同的行  <!DOCTYPE html><html>    <head>      ...

  4. 给table中某一列的文字右对齐

    一般来说,没写过jquery的前端人员,肯定是定义一个class,给每一行的那列加上align_r{text-align:right}.这是很麻烦的. 所以用jquery来写,可以$("ta ...

  5. 关于页面中table中相同的列自动合并

    代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  6. OAF TABLE中添加序号列

    在实际的OAF页面TABLE的使用中,会有很多时候需要在前台页面中显示序号,虽然在sql中可以使用rownum来获得序号,但是rounum的优先级比order by 高,所以在语句中order by ...

  7. 如何让Table中的第一列和第二列的值相乘然后赋值给第三列

    因为需求的原因所以这样做,不废话了,直接上代码,我用的GridView绑定的数据,table也一样,因为GridView通过浏览器编译后的代码就是table.下面是aspx页面的Html代码: < ...

  8. 封装Jquery 合并table中任何同列数据

    封装代码: jQuery.fn.rowspan = function (colIdx) { //封装JQuery同列值相同合并小插件 return this.each(function () { va ...

  9. 锁定TABLE的首行和首列

    1. 2. 3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...

随机推荐

  1. Excel 如何按条件计数和按条件求和(如按月求和)

    1.使用SUMPRODUCT进行多条件计数语法:=SUMPRODUCT((条件1)*(条件2)*(条件3)* …(条件n))作用:统计同时满足条件1.条件2到条件n的记录的个数.实例:=SUMPROD ...

  2. Http的请求对象

    Servlet 客户端 HTTP 请求 当浏览器请求网页时,它会向 Web 服务器发送特定信息,这些信息不能被直接读取,因为这些信息是作为 HTTP 请求的头的一部分进行传输的.您可以查看 HTTP ...

  3. 单链表在不知头结点的情况下对第i个元素的删除

    一.首先,看看单链表中第i个元素的删除: Status ListDelete_L (LinkList &L,int i,ElemType &e){ //在带头结点的单链表L中,删除第i ...

  4. ESL python调用C模块时传递unicode字符串报错问题解决

    在是用freeswitch时利用ESL的python调用时传递字符串报错 TypeError: in method 'ESLconnection_api', argument 2 of type 'c ...

  5. 【软件工程】用map 实现把英语文本文件词和个数打印出来

    #include <iostream> #include <fstream> #include <string> #include <map> usin ...

  6. sql中列数据横着显示

    列数据横着显示:CREATE TABLE StudenScore(stuname VARCHAR(25) , kc VARCHAR(25) , fs INT)INSERT INTO StudenSco ...

  7. 【PowerOJ1740&网络流24题 圆桌聚餐】(最大流)

    题意: 来自n个不同国家的代表开会,每个国家代表数为ci 会场有m张圆桌,每张桌子可容纳mi人 不希望有同一个国家的代表在同一张桌子上就餐 设计一个合法方案 (n,m<=300) 思路:最大流, ...

  8. JS控制鼠标点击事件

    鼠标点击事件就是当鼠标点击元素时,就会出现另一个窗口,类似于百度首页中右上角的“登录”这个按钮,当鼠标点击 登录时,就会出现登录窗口.大体的意思就是这样,直接上代码了,简单易懂. <!DOCTY ...

  9. frame和bounds的区别与联系

    首先先看一下下面两个属性的代码实现: -(CGRect)frame{ return CGRectMake(self.frame.origin.x,self.frame.origin.y,self.fr ...

  10. co + Generator 写的迭代器 类似 async.whilst

    试着用用Koa,项目里原来有用到async 的whilst 用koa再用async感觉不太舒服,就用Generator+co写了个类似async whist的调用的主体功能,像传参这些没有作到 var ...