📄 win_table_edit.asp
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>表格属性</title>
<link rel="stylesheet" href="html_edit.css" type="text/css">
<script language="javascript">
var td_bgcolor;
var td_fontcolor;
var tr_bgcolor;
var tr_fontcolor;
var table_bgcolor;
var table_bordercolor;
var table_fontcolor;
function onLoad()
{
var DHTMLSafe=window.dialogArguments.DHTMLSafe;
var trSel = DHTMLSafe.DOM.selection.createRange();
trSel.collapse();
trSel.select();
thisCell = DHTMLSafe.DOM.selection.createRange().parentElement();
while(thisCell.tagName!="TD"&&thisCell.tagName!="HTML")
thisCell = thisCell.parentElement;
if(thisCell.tagName=="HTML")
{
alert("未选择TD标签");
window.close();
}
thisRow = thisCell;
while(thisRow.tagName!="TR"&&thisRow.tagName!="HTML")
thisRow = thisRow.parentElement;
if(thisRow.tagName=="HTML")
{
alert("未选择TR标签");
window.close();
}
thisTable = thisRow;
while(thisTable.tagName!="TABLE"&&thisTable.tagName!="HTML")
{
thisTable = thisTable.parentElement;
}
if(thisTable.tagName=="HTML")
{
alert("未选择TABLE标签");
window.close();
}
tro.style.visibility = "hidden";
tableo.style.visibility = "hidden";
table2.style.visibility = "hidden";
tdo.style.visibility = "visible";
var et = edit_table_form;
et.table_border.value = thisTable.getAttribute("BORDER");
et.table_cellpadding.value = thisTable.getAttribute("CELLPADDING");
et.table_cellspacing.value = thisTable.getAttribute("CELLSPACING");
et.table_width.value = thisTable.getAttribute("WIDTH");
et.table_height.value = thisTable.getAttribute("HEIGHT");
et.td_width.value = thisCell.getAttribute("WIDTH");
et.td_height.value = thisCell.getAttribute("HEIGHT");
window.document.all.item("td_bgcolor").bgColor = thisCell.getAttribute("BGCOLOR");
window.document.all.item("td_fontcolor").bgColor = thisCell.style.color;
window.document.all.item("tr_bgcolor").bgColor = thisRow.getAttribute("BGCOLOR");
window.document.all.item("tr_fontcolor").bgColor = thisRow.style.color;
window.document.all.item("table_bgcolor").bgColor = thisTable.getAttribute("BGCOLOR");
window.document.all.item("table_bordercolor").bgColor = thisTable.getAttribute("BORDERCOLOR");
window.document.all.item("table_fontcolor").bgColor = thisTable.style.color;
}
function toggle(sel)
{
switch(sel)
{
case 'tr':
trC.className="latched";
tro.style.visibility = 'visible';
tdC.className="outset";
tdo.style.visibility = 'hidden';
tableC.className="outset";
tableo.style.visibility = 'hidden';
table2.style.visibility = 'hidden';
break;
case 'td':
tdC.className="latched";
tdo.style.visibility = 'visible';
trC.className="outset";
tro.style.visibility = 'hidden';
tableC.className="outset";
tableo.style.visibility = 'hidden';
table2.style.visibility = 'hidden';
break;
case 'table':
tableC.className="latched";
tableo.style.visibility = 'visible';
trC.className="outset";
tro.style.visibility = 'hidden';
tdC.className="outset";
tdo.style.visibility = 'hidden';
table2.style.visibility = 'hidden';
break;
case 'table2':
tableo.style.visibility = 'hidden';
table2.style.visibility = 'visible';
break;
}
}
function apply()
{
var et = edit_table_form;
thisCell.setAttribute("BGCOLOR", td_bgcolor, 0);
if (et.td_valign.value != "current") thisCell.setAttribute("VALIGN", et.td_valign.value, 0);
if (et.td_align.value != "current") thisCell.setAttribute("ALIGN", et.td_align.value, 0);
if (et.td_fontfamily.value != "current") thisCell.style.fontFamily = et.td_fontfamily.value;
thisCell.style.color = td_fontcolor;
if (et.td_fontsize.value != "current") thisCell.style.fontSize = et.td_fontsize.value;
if (et.td_width.value.length > 0) thisCell.setAttribute("WIDTH", et.td_width.value,0);
if (et.td_height.value.length > 0) thisCell.setAttribute("HEIGHT", et.td_height.value,0);
thisRow.setAttribute("BGCOLOR", tr_bgcolor, 0);
if (et.tr_valign.value != "current") thisRow.setAttribute("VALIGN", et.tr_valign.value, 0);
if (et.tr_align.value != "current") thisRow.setAttribute("ALIGN", et.tr_align.value, 0);
if (et.tr_fontfamily.value != "current") thisRow.style.fontFamily = et.tr_fontfamily.value;
thisRow.style.color = tr_fontcolor;
if (et.tr_fontsize.value != "current") thisRow.style.fontSize = et.tr_fontsize.value;
if (et.tr_style.value.length > 0) thisRow.STYLE = et.tr_style.value;
thisTable.setAttribute("BGCOLOR", table_bgcolor, 0);
if (et.table_border.value.length > 0) thisTable.setAttribute("BORDER", et.table_border.value, 0);
if (et.table_cellspacing.value.length > 0) thisTable.setAttribute("CELLSPACING", et.table_cellspacing.value, 0);
if (et.table_cellpadding.value.length > 0) thisTable.setAttribute("CELLPADDING", et.table_cellpadding.value, 0);
if (et.table_width.value.length > 0) thisTable.setAttribute("WIDTH", et.table_width.value, 0);
if (et.table_height.value.length > 0) thisTable.setAttribute("HEIGHT", et.table_height.value, 0);
if (et.table_valign.value != "current") thisTable.setAttribute("VALIGN", et.table_valign.value, 0);
if (et.table_align.value != "current") thisTable.setAttribute("ALIGN", et.table_align.value, 0);
thisTable.setAttribute("BORDERCOLOR", table_bordercolor, 0);
if (et.table_fontfamily.value != "current") thisTable.style.fontFamily = et.table_fontfamily.value;
thisTable.style.color = table_fontcolor;
if (et.table_fontsize.value != "current") thisTable.style.fontSize = et.table_fontsize.value;
if (et.table_style.value.length > 0) thisTable.STYLE = et.table_style.value;
window.dialogArguments.DHTMLSafe.focus();
this.window.close();
}
function custom_color(obj)
{
if (obj.selectedIndex == 1)
{
var c = prompt("请输入正确的颜色代码", "");
if (c != null)
{
var oOption = document.createElement("OPTION");
oOption.text = c;
oOption.value = c;
oOption.style.color = c;
obj.add(oOption);
obj.selectedIndex = obj.options.length-1;
}
}
}
function showCol(i)
{
var col=window.showModalDialog("win_select_color.asp","s","dialogWidth=300px;dialogHeight=270px;status=0");
if(col && col!="")
{
switch(i)
{
case 0:
window.document.all.item("td_bgcolor").bgColor=col;
td_bgcolor=col;
break;
case 1:
window.document.all.item("td_fontcolor").bgColor=col;
td_fontcolor=col;
break;
case 2:
window.document.all.item("tr_bgcolor").bgColor=col;
tr_bgcolor=col;
break;
case 3:
window.document.all.item("tr_fontcolor").bgColor=col;
tr_fontcolor=col;
break;
case 4:
window.document.all.item("table_bgcolor").bgColor=col;
table_bgcolor=col;
break;
case 5:
window.document.all.item("table_bordercolor").bgColor=col;
table_bordercolor=col;
break;
case 6:
window.document.all.item("table_fontcolor").bgColor=col;
table_fontcolor=col;
break;
}
}
}
function is_int()
{
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
</head>
<body bgcolor="menu" topmargin="5" onLoad="onLoad()" style="border:0;overflow:hidden;">
<form style="position:absolute" id="edit_table_form">
<div id="tdo" style="position:absolute;">
<fieldset style="padding-bottom:5px"><legend disabled>单元格属性</legend>
<table cellpadding="1" cellspacing="3" border="0" width=280>
<tr>
<td width="100">背景颜色</td>
<td>
<table id="td_bgcolor" border="0" cellspacing="0" cellpadding="0" >
<tr><td width="100%" onClick="showCol(0);"><img border="0" src="images/clrbox.gif" width="16" height="16"></td></tr>
</table>
</td>
</tr>
<tr>
<td>垂直对齐</td>
<td><select name="td_valign" style="width:150">
<option value="current" selected>当前对齐</option>
<option value="top">顶端</option>
<option value="bottom">底端</option>
<option value="middle">居中</option>
<option value="baseline">基线</option>
</select></td>
</tr>
<tr>
<td>水平对齐</td>
<td><select name="td_align" style="width:150">
<option value="current" selected>当前对齐</option>
<option value="left">居左</option>
<option value="center">居中</option>
<option value="right">居右</option>
</select></td>
</tr>
<tr>
<td>文本字体</td>
<td><select name="td_fontfamily" style="width:150">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -