jquery接收Excel复制内容粘贴至html表格
//excle复制粘贴功能 $(document).ready(function(){ $(document.body).bind({ paste: function(e) { if (window.clipboardData) { return ; } var clipboardData = e.originalEvent.clipboardData; processData(clipboardData); } }); document.onkeyup = function(e) { if (window.clipboardData) { e = window.event || e; var keyCode = e.keyCode || e.which || e.charCode; var ctrlKey = e.ctrlKey || e.metaKey; if (ctrlKey && keyCode == 86) { var clipboardData = window.clipboardData; processData(clipboardData); } } return false; } }); //粘贴函数 var processData = function(clipboardData) { var data = clipboardData.getData('Text').split('\n'); var dataHtml = ''; for (var i = 0; i < data.length; i++) { if (!data[i]) { continue ; } var bugdetData = data[i].split('\t'); BC_planimportDBase.Insert(); BC_planimportDBase.setFieldValue("GZJD",bugdetData[0]); BC_planimportDBase.setFieldValue("GZNR",bugdetData[1]); BC_planimportDBase.setFieldValue("JHKS",bugdetData[2]); BC_planimportDBase.setFieldValue("JHWC",bugdetData[3]); BC_planimportDBase.setFieldValue("SJKS",bugdetData[4]); BC_planimportDBase.setFieldValue("SJWC",bugdetData[5]); BC_planimportDBase.setFieldValue("ZRBM",bugdetData[6]); BC_planimportDBase.setFieldValue("ZRR",bugdetData[7]); BC_planimportDBase.setFieldValue("JFW",bugdetData[8]); BC_planimportDBase.setFieldValue("XZBMZRR",bugdetData[9]); BC_planimportDBase.setFieldValue("GZDD",bugdetData[10]); BC_planimportDBase.setFieldValue("BZ",bugdetData[11]); BC_planimportDBase.setFieldValue("plancode",syncCallGetPlanCode()); } };