/**
*
*
* @param table_id 表格的id
* @param container_id 容器的id
* @param form_id 提交表單的id
* @param rownumbers
*/
function getXlsFromTbl(table_id, container_id ,form_id, title, rownumbers) {
if (table_id != null && table_id != "" && table_id != "null") {
'#'table_id), $('#'container_id), rownumbers);
}
返回;
}
var fileName = getExcelFileName(title);
}
catch (e) {
alert("匯出例外:" e.name "->" e.description "!");
}
}
Datafunction getTblm(tabled) conpampero; >
var outStr = "";
if (tableobj != null) {
for (i = 0; i //var Lenc = curTbl.rows(i).cells.length; if (rownumbers == false) {
th = containerobj.find('TH:not(:first-child)');
else {
th = containerobj.find('TH');
> th.each(函數(索引, 元素) {
content = $(element).text();
內容物= 內容.替換(/(^s* )|(s*$)/g, "");//去掉空格
outStr = content ","; }
var tmp = "";
for (i = 0; i var row = eval(rowdata[i]);
for (each in row) {
if($(row[each]).text() === null || $(row[each]).text() ==[each]).text() === null || $(row[each]).text() == ""){
outStr = row[each] ",";
}
else outStr = $ (row[each]).text() ",";
}
🎜> else {
outStr = null; 🎜> alert (inTbl " null!");
}
return outStr;
}
function getExcelFileName(title) {p d . getYear();
var curMonth = "" (d.getMonth() 1);
var curDate = "" d.getDate();
🎜> var curMinute = "" d.getMinutes();
var curSecond = "" d.getSeconds();
if (curMonth.length == 1) {
curMonth = "0" curMonth;
}
if (curDate.length == 1) {
curDate = "0" curDate;
}
if (curHour.length == 1) {
curHour = "0" curHour;
}
if (curMinute.length == 1) {
curMinute = "0" curMinute;
}
if (curSecond.length == 1) {
curSecond = "0" curSecond;
}
var fileName = title "_" curYear curMonth curDate "_"
回傳檔案名稱;
}
function doFileExport(formobj, 檔案名稱, 內容) {
; formobj.html("");
$("#filename").val(檔名);
$("#content").val(content);
formobj.submit();
}
連接是頁面調用的javascript:
複製代碼