/* *☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ *★ ★ *☆ eWebEditor - eWebSoft在线文本编辑器飞鱼修改版 ☆ *★ ★ *☆ 版权所有: eWebSoft.com ☆ *★ ★ *☆ 程序制作: eWeb开发团队 ☆ *★ email:webmaster@webasp.net ★ *☆ QQ:589808 ☆ *★ ★ *☆ 相关网址: [原版地址]http://www.eWebSoft.com/Product/eWebEditor/ ☆ *★ [支持论坛]http://bbs.eWebSoft.com/ ★ *☆ ☆ *★ 主页地址: http://www.fiyu.net/ 飞鱼论坛 ★ *☆ 有什么问题欢迎到飞鱼论坛提出! ☆ *★ ★ *★ ★ *☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ */ // 表格相关全局变量 var selectedTD var selectedTR var selectedTBODY var selectedTable // 插入表格 function TableInsert(){ if (!isTableSelected()){ ShowDialog('dialog/table.htm', 350, 380, true); } } // 修改表格属性 function TableProp(){ if (isTableSelected()||isCursorInTableCell()){ ShowDialog('dialog/table.htm?action=modify', 350, 380, true); } } // 修改单元格属性 function TableCellProp(){ if (isCursorInTableCell()){ ShowDialog('dialog/tablecell.htm', 350, 280, true); } } // 拆分单元格 function TableCellSplit(){ if (isCursorInTableCell()){ ShowDialog('dialog/tablecellsplit.htm', 200, 150, true); } } // 修改表格行属性 function TableRowProp(){ if (isCursorInTableCell()){ ShowDialog('dialog/tablecell.htm?action=row', 350, 280, true); } } // 插入行(在上方) function TableRowInsertAbove() { if (isCursorInTableCell()){ var numCols = 0 allCells = selectedTR.cells for (var i=0;i1时 while (selectedTD.rowSpan > 1 && addRowsNoSpan > 0){ var nextRow = allRows[selectedTR.rowIndex+selectedTD.rowSpan-1]; selectedTD.rowSpan -= 1; var ncLeftColSpan = 0; var position = -1; for (var n=0; nnsLeftColSpan){ position = n; break; } } var newTD=nextRow.insertCell(position); newTD.innerHTML = " "; if (borderShown == "yes") { newTD.runtimeStyle.border = "1px dotted #BFBFBF"; } addRowsNoSpan -= 1; } // rowspan=1时 for (var n=0; n1)&&(allRows[j].cells[k].rowSpan>=selectedTR.rowIndex-allRows[j].rowIndex+1)){ allRows[j].cells[k].rowSpan += 1; } } } // 当前行 for (i = 0; i < allCells.length; i++) { if (i!=selectedTD.cellIndex){ selectedTR.cells[i].rowSpan += 1; }else{ newTD = newTR.insertCell(); newTD.colSpan = selectedTD.colSpan; newTD.innerHTML = " "; if (borderShown == "yes") { newTD.runtimeStyle.border = "1px dotted #BFBFBF"; } } } } } // 删除行 function TableRowDelete() { if (isCursorInTableCell()) { selectedTable.deleteRow(selectedTR.rowIndex) } } // 插入列(在左侧) function TableColInsertLeft() { if (isCursorInTableCell()) { moveFromEnd = (selectedTR.cells.length-1) - (selectedTD.cellIndex) allRows = selectedTable.rows for (i=0;i 1) { allCellsInRow[position].colSpan = allCellsInRow[position].colSpan - 1 } else { allRows[i].deleteCell(position) } } } } // 拆分列 function TableColSplit(nCols){ if (!isCursorInTableCell()) return; if (nCols<2) return; var addCols = nCols - 1; var addColsNoSpan = addCols; var newCell; var nsLeftColSpan = 0; var nsLeftRowSpanMoreOne = 0; for (var i=0; i 1){ nsLeftRowSpanMoreOne += 1; } } var allRows = selectedTable.rows // colSpan>1时 while (selectedTD.colSpan > 1 && addColsNoSpan > 0) { newCell = selectedTR.insertCell(selectedTD.cellIndex+1); newCell.innerHTML = " " if (borderShown == "yes") { newCell.runtimeStyle.border = "1px dotted #BFBFBF" } selectedTD.colSpan -= 1; addColsNoSpan -= 1; } // colSpan=1时 for (i=0;insLeftColSpan){ position = n; break; } } if (selectedTR.rowIndex!=i){ if (position!=-1){ allRows[i].cells[position+nsLeftRowSpanMoreOne].colSpan += addColsNoSpan; } }else{ for (var n=0; n