⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table.htm

📁 八星瓢虫留言本特点:采用PHP+Access数据库实现
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language=javascript src="dialog.js"></script>

<script language="javascript">
document.write ("<link href='../language/" + AvailableLangs["Active"] + ".css' type='text/css' rel='stylesheet'>");
document.write ("<link href='dialog.css' type='text/css' rel='stylesheet'>");

var sAction = URLParams['action'] ;
var sTitle = lang["DlgComInsert"];

var oControl;
var oSeletion;
var sRangeType;

var sRow = "2";
var sCol = "2";
var sAlign = "";
var sBorder = "1";
var sCellPadding = "3";
var sCellSpacing = "2";
var sWidth = "";
var sHeight = "";
var sBorderColor = "#000000";
var sBgColor = "#FFFFFF";

var sImage = "";
var sRepeat = "";
var sAttachment = "";
var sBorderStyle = "";

var sWidthUnit = "%";
var bWidthCheck = true;
var bWidthDisable = false;
var sWidthValue = "100";

var sHeightUnit = "%";
var bHeightCheck = false;
var bHeightDisable = true;
var sHeightValue = "";

oSelection = dialogArguments.eWebEditor.document.selection.createRange();
sRangeType = dialogArguments.eWebEditor.document.selection.type;

if (sAction == "modify"){
    if (sRangeType == "Control"){
        if (oSelection.item(0).tagName == "TABLE"){
            oControl = oSelection.item(0);
        }
    }else{
        oControl = getParentObject(oSelection.parentElement(), "TABLE");
    }
    if (oControl){
        sAction = "MODI";
        sTitle = lang["DlgComModify"];
        sRow = oControl.rows.length;
        sCol = getColCount(oControl);
        sAlign = oControl.align;
        sBorder = oControl.border;
        sCellPadding = oControl.cellPadding;
        sCellSpacing = oControl.cellSpacing;
        sWidth = oControl.width;
        sHeight = oControl.height;
        sBorderColor = oControl.borderColor;
        sBgColor = oControl.bgColor;
        sImage = oControl.style.backgroundImage;
        sRepeat = oControl.style.backgroundRepeat;
        sAttachment = oControl.style.backgroundAttachment;
        sBorderStyle = oControl.style.borderStyle;
        sImage = sImage.substr(4, sImage.length-5);
    }
}

function getParentObject(obj, tag){
    while(obj!=null && obj.tagName!=tag)
        obj=obj.parentElement;
    return obj;
}

document.write("<title>" + lang["DlgTab"] + "(" + sTitle + ")</title>");

function InitDocument(){
    AvailableLangs.TranslatePage(document);

    SearchSelectValue(d_align, sAlign.toLowerCase());
    SearchSelectValue(d_borderstyle, sBorderStyle.toLowerCase());

    if (sAction == "MODI"){
        if (sWidth == ""){
            bWidthCheck = false;
            bWidthDisable = true;
            sWidthValue = "100";
            sWidthUnit = "%";
        }else{
            bWidthCheck = true;
            bWidthDisable = false;
            if (sWidth.substr(sWidth.length-1) == "%"){
                sWidthValue = sWidth.substring(0, sWidth.length-1);
                sWidthUnit = "%";
            }else{
                sWidthUnit = "";
                sWidthValue = parseInt(sWidth);
                if (isNaN(sWidthValue)) sWidthValue = "";
            }
        }
        if (sHeight == ""){
            bHeightCheck = false;
            bHeightDisable = true;
            sHeightValue = "100";
            sHeightUnit = "%";
        }else{
            bHeightCheck = true;
            bHeightDisable = false;
            if (sHeight.substr(sHeight.length-1) == "%"){
                sHeightValue = sHeight.substring(0, sHeight.length-1);
                sHeightUnit = "%";
            }else{
                sHeightUnit = "";
                sHeightValue = parseInt(sHeight);
                if (isNaN(sHeightValue)) sHeightValue = "";
            }
        }

    }

    switch(sWidthUnit){
    case "%":
        d_widthunit.selectedIndex = 1;
        break;
    default:
        sWidthUnit = "";
        d_widthunit.selectedIndex = 0;
        break;
    }
    switch(sHeightUnit){
    case "%":
        d_heightunit.selectedIndex = 1;
        break;
    default:
        sHeightUnit = "";
        d_heightunit.selectedIndex = 0;
        break;
    }

    d_row.value = sRow;
    d_col.value = sCol;
    d_border.value = sBorder;
    d_cellspacing.value = sCellSpacing;
    d_cellpadding.value = sCellPadding;
    d_widthvalue.value = sWidthValue;
    d_widthvalue.disabled = bWidthDisable;
    d_widthunit.disabled = bWidthDisable;
    d_heightvalue.value = sHeightValue;
    d_heightvalue.disabled = bHeightDisable;
    d_heightunit.disabled = bHeightDisable;
    d_bordercolor.value = sBorderColor;
    s_bordercolor.style.backgroundColor = sBorderColor;
    d_bgcolor.value = sBgColor;
    s_bgcolor.style.backgroundColor = sBgColor;
    d_widthcheck.checked = bWidthCheck;
    d_heightcheck.checked = bHeightCheck;
    d_image.value = sImage;
    d_repeat.value = sRepeat;
    d_attachment.value = sAttachment;

    adjustDialog();
}

function MoreThanOne(obj, sErr){
    var b=false;
    if (obj.value!=""){
        obj.value=parseFloat(obj.value);
        if (obj.value!="0"){
            b=true;
        }
    }
    if (b==false){
        BaseAlert(obj,sErr);
        return false;
    }
    return true;
}

function getColCount(oTable) {
    var intCount = 0;
    if (oTable != null) {
        for(var i = 0; i < oTable.rows.length; i++){
            if (oTable.rows[i].cells.length > intCount) intCount = oTable.rows[i].cells.length;
        }
    }
    return intCount;
}

function InsertRows( oTable ) {
    if ( oTable ) {
        var elRow=oTable.insertRow();
        for(var i=0; i<oTable.rows[0].cells.length; i++){
            var elCell = elRow.insertCell();
            elCell.innerHTML = "&nbsp;";
        }
    }
}

function InsertCols( oTable ) {
    if ( oTable ) {
        for(var i=0; i<oTable.rows.length; i++){
            var elCell = oTable.rows[i].insertCell();
            elCell.innerHTML = "&nbsp;"
        }
    }
}

function DeleteRows( oTable ) {
    if ( oTable ) {
        oTable.deleteRow();
    }
}

function DeleteCols( oTable ) {
    if ( oTable ) {
        for(var i=0;i<oTable.rows.length;i++){
            oTable.rows[i].deleteCell();
        }
    }
}

function ok(){
    sBorderColor = d_bordercolor.value;
    if (!IsColor(sBorderColor)){
        BaseAlert(d_bordercolor,lang["ErrColorBorder"]);
        return;
    }

    sBgColor = d_bgcolor.value;
    if (!IsColor(sBgColor)){
        BaseAlert(d_bgcolor,lang["ErrColorBg"]);
        return;
    }
    if (!MoreThanOne(d_row,lang["DlgTabInvalidRow"])) return;
    if (!MoreThanOne(d_col,lang["DlgTabInvalidCol"])) return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -