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

📄 edittable.htm

📁 基于ASP的OA办公系统有BBS
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title>表格属性</title>
<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("SelectColor.htm","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;
		}
   
}

</script>
<link rel="stylesheet" href="inc/editor.css" type="text/css">
<link rel="stylesheet" href="css/css.css" type="text/css">
<style type="text/css">
<!--
body {
  border:0;
  overflow:	hidden;
  margin: 0;
  font:	MessageBox;
  background-color:buttonface;
}

-->
</style>
</head>

<body topmargin="5" onLoad="onLoad()" style="border:0;overflow:hidden;">
<form style="position:absolute" id="edit_table_form">
  <div id="tdo" style="position:absolute;"> 
    <table width="330" border="0" cellpadding="0" cellspacing="3" height="243">
		<tr>
			<td colspan="2" align="center" bgcolor="white" class="title"><b>单元格属性</b></td>
		</tr>
		<tr>
			<td>
				背景颜色
			</td>
			<td>
			<table id="td_bgcolor" border="0" cellspacing="0" cellpadding="0" >
                <tr> 
                  <td width="100%" onClick="showCol(0);"><img border="0" src="../editor/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">
					<option value="current" selected>当前</option>
					<option value="arial,verdana,helvetica,geneva">arial,verdana,helvetica,...</option>
					<option value="arial,helvetica">Arial</option>
					<option value="verdana,helvetica">Verdana</option>
					<option value="helvetica,arial">Helvetica</option>
					<option value="geneva,arial,helvetica">Geneva</option>
					<option value="sans-serif,arial">Sans-Serif</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				文本颜色
			</td>
			<td>
			<table id="td_fontcolor" border="0" cellspacing="0" cellpadding="0" >
                <tr> 
                  <td width="100%" onClick="showCol(1);"><img border="0" src="../editor/images/clrbox.gif" width="16" height="16"></td>
                </tr>
              </table>
			</td>
		</tr>
		<tr>
			<td>
				字体大小
			</td>
			<td>
				<select name="td_fontsize" style="width:150">
					<option value="current" selected>不变</option>
					<option value="8pt">8pt</option>
					<option value="8pt">9pt</option>
					<option value="10pt">10pt</option>
					<option value="12pt">12pt</option>
					<option value="14pt">14pt</option>
					
				</select>
			</td>
		</tr>
		
		<tr>
			<td width="100">
				单元格宽
			</td>
			<td>
				<input type="text" name="td_width" size="5" style="border:1px solid black;">
			</td>
		</tr>
		<tr>
			<td>
				单元格高
			</td>

⌨️ 快捷键说明

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