?? ewebeditor.aspx
字號:
// Input Hidden類
for (b=0; b < allInputs.length; b++) {
if (borderShown == "no") {
if (allInputs[b].type.toUpperCase() == "HIDDEN") {
allInputs[b].runtimeStyle.border = "1px dashed #000000"
allInputs[b].runtimeStyle.width = "15px"
allInputs[b].runtimeStyle.height = "15px"
allInputs[b].runtimeStyle.backgroundColor = "#FDADAD"
allInputs[b].runtimeStyle.color = "#FDADAD"
}
} else {
if (allInputs[b].type.toUpperCase() == "HIDDEN")
allInputs[b].runtimeStyle.cssText = ""
}
}
// 表格
for (i=0; i < allTables.length; i++) {
if (borderShown == "no") {
allTables[i].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allTables[i].runtimeStyle.cssText = ""
}
allRows = allTables[i].rows
for (y=0; y < allRows.length; y++) {
allCellsInRow = allRows[y].cells
for (x=0; x < allCellsInRow.length; x++) {
if (borderShown == "no") {
allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allCellsInRow[x].runtimeStyle.cssText = ""
}
}
}
}
// 鏈接 A
for (a=0; a < allLinks.length; a++) {
if (borderShown == "no") {
if (allLinks[a].href.toUpperCase() == "") {
allLinks[a].runtimeStyle.border = "1px dashed #000000"
allLinks[a].runtimeStyle.width = "20px"
allLinks[a].runtimeStyle.height = "16px"
allLinks[a].runtimeStyle.backgroundColor = "#FFFFCC"
allLinks[a].runtimeStyle.color = "#FFFFCC"
}
} else {
allLinks[a].runtimeStyle.cssText = ""
}
}
if (borderShown == "no") {
borderShown = "yes"
} else {
borderShown = "no"
}
scrollUp()
}
// 返回頁面最上部
function scrollUp() {
eWebEditor.scrollBy(0,0);
}
// 縮放操作
var nCurrZoomSize = 100;
var aZoomSize = new Array(10, 25, 50, 75, 100, 150, 200, 500);
function doZoom(size) {
eWebEditor.document.body.runtimeStyle.zoom = size + "%";
nCurrZoomSize = size;
}
// 拼寫檢查
function spellCheck(){
ShowDialog('dialog/spellcheck.htm', 300, 220, true)
}
// 查找替換
function findReplace(){
ShowDialog('dialog/findreplace.htm', 320, 165, true)
}
// 相對(absolute)或絕對位置(static)
function absolutePosition(){
var objReference = null;
var RangeType = eWebEditor.document.selection.type;
if (RangeType != "Control") return;
var selectedRange = eWebEditor.document.selection.createRange();
for (var i=0; i<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (objReference.style.position != 'absolute') {
objReference.style.position='absolute';
}else{
objReference.style.position='static';
}
}
eWebEditor.content = false;
eWebEditor.setActive();
}
// 上移(forward)或下移(backward)一層
function zIndex(action){
var objReference = null;
var RangeType = eWebEditor.document.selection.type;
if (RangeType != "Control") return;
var selectedRange = eWebEditor.document.selection.createRange();
for (var i=0; i<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (action=='forward'){
objReference.style.zIndex +=1;
}else{
objReference.style.zIndex -=1;
}
objReference.style.position='absolute';
}
eWebEditor.content = false;
eWebEditor.setActive();
}
// 是否選中指定類型的控件
function isControlSelected(tag){
if (eWebEditor.document.selection.type == "Control") {
var oControlRange = eWebEditor.document.selection.createRange();
if (oControlRange(0).tagName.toUpperCase() == tag) {
return true;
}
}
return false;
}
// 改變編輯區高度
function sizeChange(size){
for (var i=0; i<parent.frames.length; i++){
if (parent.frames[i].document==self.document){
var obj=parent.frames[i].frameElement;
var height = parseInt(obj.offsetHeight);
if (height+size>=300){
obj.height=height+size;
}
break;
}
}
}
/*
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*/
// 表格相關全局變量
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;i<allCells.length;i++) {
numCols = numCols + allCells[i].getAttribute('colSpan')
}
var newTR = selectedTable.insertRow(selectedTR.rowIndex)
for (i = 0; i < numCols; i++) {
newTD = newTR.insertCell()
newTD.innerHTML = " "
if (borderShown == "yes") {
newTD.runtimeStyle.border = "1px dotted #BFBFBF"
}
}
}
}
// 插入行(在下方)
function TableRowInsertBelow() {
if (isCursorInTableCell()){
var numCols = 0
allCells = selectedTR.cells
for (var i=0;i<allCells.length;i++) {
numCols = numCols + allCells[i].getAttribute('colSpan')
}
var newTR = selectedTable.insertRow(selectedTR.rowIndex+1)
for (i = 0; i < numCols; i++) {
newTD = newTR.insertCell()
newTD.innerHTML = " "
if (borderShown == "yes") {
newTD.runtimeStyle.border = "1px dotted #BFBFBF"
}
}
}
}
// 合并行(向下方)
function TableRowMerge() {
if (isCursorInTableCell()) {
var rowSpanTD = selectedTD.getAttribute('rowSpan')
allRows = selectedTable.rows
if (selectedTR.rowIndex +1 != allRows.length) {
var allCellsInNextRow = allRows[selectedTR.rowIndex+selectedTD.rowSpan].cells
var addRowSpan = allCellsInNextRow[selectedTD.cellIndex].getAttribute('rowSpan')
var moveTo = selectedTD.rowSpan
if (!addRowSpan) addRowSpan = 1;
selectedTD.rowSpan = selectedTD.rowSpan + addRowSpan
allRows[selectedTR.rowIndex + moveTo].deleteCell(selectedTD.cellIndex)
}
}
}
// 拆分行
function TableRowSplit(nRows){
if (!isCursorInTableCell()) return;
if (nRows<2) return;
var addRows = nRows - 1;
var addRowsNoSpan = addRows;
var nsLeftColSpan = 0;
for (var i=0; i<selectedTD.cellIndex; i++){
nsLeftColSpan += selectedTR.cells[i].colSpan;
}
var allRows = selectedTable.rows;
// rowspan>1時
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; n<nextRow.cells.length; n++){
ncLeftColSpan += nextRow.cells[n].getAttribute('colSpan');
if (ncLeftColSpan>nsLeftColSpan){
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; n<addRowsNoSpan; n++){
var numCols = 0
allCells = selectedTR.cells
for (var i=0;i<allCells.length;i++) {
numCols = numCols + allCells[i].getAttribute('colSpan')
}
var newTR = selectedTable.insertRow(selectedTR.rowIndex+1)
// 上方行的rowspan達到這行
for (var j=0; j<selectedTR.rowIndex; j++){
for (var k=0; k<allRows[j].cells.length; k++){
if ((allRows[j].cells[k].rowSpan>1)&&(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<allRows.length;i++) {
rowCount = allRows[i].cells.length - 1
position = rowCount - moveFromEnd
if (position < 0) {
position = 0
}
newCell = allRows[i].insertCell(position)
newCell.innerHTML = " "
if (borderShown == "yes") {
newCell.runtimeStyle.border = "1px dotted #BFBFBF"
}
}
}
}
// 插入列(在右側)
function TableColInsertRight() {
if (isCursorInTableCell()) {
moveFromEnd = (selectedTR.cells.length-1) - (selectedTD.cellIndex)
allRows = selectedTable.rows
for (i=0;i<allRows.length;i++) {
rowCount = allRows[i].cells.length - 1
position = rowCount - moveFromEnd
if (position < 0) {
position = 0
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -