首页登陆欢迎您!
首页登陆 > 运维知识 > 运维知识JS完结两报表里多少来回转移的点子_javascript手艺_脚本之家

运维知识JS完结两报表里多少来回转移的点子_javascript手艺_脚本之家

时间:2019-12-06

本文实例讲述了JS实现两表格里数据来回转移的方法。分享给大家供大家参考。具体分析如下:

最近做项目里用到了一个 两个表格里数据的来回转移,用JS稍微做了下,界面也没有去弄很漂亮

感觉写得有点繁琐了,有时间再改进哈

提货送货  a{ text-decoration: none; text-align: center; } #main{ postion:relation; } /*左边层*/ #div1 { float: left; postion:relation; } #div1 #left{ float:left; } /*中间层*/ #div2{ float:left; margin-top:50px; } #div2 #div2_2{ margin-top:15px; } /*右边层*/ #div3 { float: left; } #tab_sendValue1 input,#tab_sendValue3 input{ width:40px; border:none; }   //全选事件 function myclick{ var items = document.getElementsByName; for(var i = 0;i < items.length;i++){ items[i].checked = e.checked; } } //移动左边表格的值到右边表格 function sendValueToRight(){ var ary = new Array(); var items = document.getElementsByName; for(var i = 0;i < items.length;i++){ if{ ary[i] = document.getElementById.parentNode.parentNode.rowIndex;//保存下所选行的索引 moveValueOfLeft;//移值 } } for(var i = ary.length;i >0;i--){ var leftTbody = document.getElementById; //左边表格的tbody //判断数组ary里的值是不是行索引 if{ leftTbody.deleteRow; //移除表格的所选行 } } document.getElementById.checked = false; //全选复选框置为false } //移动左边表格的值到右边表格 function moveValueOfLeft{ var wbid = document.getElementById.value; var wbno = document.getElementById.value; var destination = document.getElementById.value; var status = document.getElementById.value; var billingdate = document.getElementById.value; var rightTbody = document.getElementById; //右边表格的tbody var tr = document.createElement; var td1 = document.createElement; var td2 = document.createElement; var td3 = document.createElement; var td4 = document.createElement; var td5 = document.createElement; var td6 = document.createElement; td1.innerHTML = "<input type='checkbox' id='check_one' name='item1' value='"+wbid+"'>"; td2.innerHTML = "<input type='text' id='id"+wbid+"' value='"+wbid+"'>"; td3.innerHTML = "<input type='text' id='no"+wbid+"' value='"+wbno+"'>"; td4.innerHTML = "<input type='text' id='des"+wbid+"' value='"+destination+"'>"; td5.innerHTML = "<input type='text' id='status"+wbid+"' value='"+status+"'>"; td6.innerHTML = "<input type='text' id='date"+wbid+"' value='"+billingdate+"'>"; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; rightTbody.appendChild; } //移动右边表格的值到左边表格 function sendValueToLeft(){ var ary1 = new Array(); var items = document.getElementsByName; for(var i = 0;i < items.length;i++){ if{ //先保存所选行的索引 在移除掉所选行 ary1[i] = document.getElementById.parentNode.parentNode.rowIndex; //保存下所选行的索引 moveValueOfRight;//移值 } } for(var i = ary1.length;i >0;i--){ var rightTbody = document.getElementById; //右边表格的tbody //判断数组ary里的值是不是行索引 if{ rightTbody.deleteRow; //移除表格的所选行 } } document.getElementById.checked = false; //全选复选框置为false } //移动右边表格的值到左边表格 function moveValueOfRight{ var wbid = document.getElementById.value; var wbno = document.getElementById.value; var destination = document.getElementById.value; var status = document.getElementById.value; var billingdate = document.getElementById.value; var leftTbody = document.getElementById; //左边表格的tbody var tr = document.createElement; var td1 = document.createElement; var td2 = document.createElement; var td3 = document.createElement; var td4 = document.createElement; var td5 = document.createElement; var td6 = document.createElement; td1.innerHTML = "<input type='checkbox' id='check_one' name='item' value='"+wbid+"'>"; td2.innerHTML = "<input type='text' id='id"+wbid+"' value='"+wbid+"'>"; td3.innerHTML = "<input type='text' id='no"+wbid+"' value='"+wbno+"'>"; td4.innerHTML = "<input type='text' id='des"+wbid+"' value='"+destination+"'>"; td5.innerHTML = "<input type='text' id='status"+wbid+"' value='"+status+"'>"; td6.innerHTML = "<input type='text' id='date"+wbid+"' value='"+billingdate+"'>"; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; tr.appendChild; leftTbody.appendChild; }             自营路线:长沙         全选

托运单号

货号

目的地

状态

托运日期

希望本文所述对大家的javascript程序设计有所帮助。

上一篇:Nodejs实现批量下载妹纸图_node.js_脚本之家 下一篇:没有了