📄 inserttable.html
字号:
<html>
<head>
<title>插入表格</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="pop.css">
<script language="JavaScript">
function checkchange()
{
if (widthspecified.checked==true){
width.disabled=false;
}
else{
width.disabled=true;
}
}
function colorchange(obj,oImg)
{
if (obj.value != "")
{
try {
oImg.style.backgroundColor = obj.value;
}
catch(e)
{
alert("你输入的不是颜色!");
obj.value = "";
oImg.style.backgroundColor = "";
}
}
}
function table(){
var tablehtml="";
tablehtml=tablehtml+"<table style='border-collapse:collapse' ";
if (align.value=="left"||align.value=="center"||align.value=="right")
tablehtml=tablehtml+"align="+align.value+" ";
if (border!="")
tablehtml=tablehtml+"border="+border.value+" "
else
tablehtml=tablehtml+"border=1 "
if(cellpad.value!="")
tablehtml=tablehtml+"cellpadding="+cellpad.value+" "
if(cellspace.value!="")
tablehtml=tablehtml+"cellspacing="+cellspace.value+" "
if(bordercolor.value!="")
tablehtml=tablehtml+"bordercolor="+bordercolor.value+" "
if(bgcolor.value!="")
tablehtml=tablehtml+"bgcolor="+bgcolor.value+" "
if (widthspecified.checked==true)
{
if(width.value!="")
{ tablehtml=tablehtml+"width="+width.value
tablehtml=tablehtml+WidthUnit.value+""
}
}
tablehtml=tablehtml+">"
for (i=1;i<=rows.value;i++)
{
tablehtml=tablehtml+"<tr>";
for (j=1;j<=columns.value;j++)
tablehtml=tablehtml+"<td> </td>";
}
tablehtml= tablehtml+"</table>";
window.returnValue = tablehtml;
window.close();
}
</script>
<script>
function IsDigit()
{
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
function selColor(obj, oImg)
{
var arr = showModalDialog("selcolor.html", "", "dialogWidth:18.5em; dialogHeight:15.5em; status:0; help:0");
if (arr != null && arr != "")
{
obj.value=arr;
oImg.style.backgroundColor=arr;
}
}
</script>
</head>
<body bgcolor=menu topmargin="5" leftmargin="5">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
<fieldset><legend>表格大小</legend>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
<td>表格行数:
<input type="text" name="rows" size="8" maxlength="2" value="1" ONKEYPRESS="event.returnValue=IsDigit();">
</td>
<td align=right>表格列数:
<input type="text" name="columns" size="8" maxlength="2" value="1" ONKEYPRESS="event.returnValue=IsDigit();">
</td>
</tr>
</table>
</fieldset>
</td></tr>
<tr><td>
<fieldset><legend>表格布局</legend>
<table border=0 cellspacing=0 cellpadding=3 width="100%">
<tr>
<td>边框粗细:
<input name="border" type="text" value="1" size="8" maxlength="2" ONKEYPRESS="event.returnValue=IsDigit();"></td>
<td align=right>对齐方式:
<select name="align">
<option selected>默认 </option>
<option value="left">居左</option>
<option value="center">居中</option>
<option value="right">居右</option>
</select></td>
</tr>
<tr>
<td>单元边距:
<input type="text" name="cellpad" size="8" maxlength="2" ONKEYPRESS="event.returnValue=IsDigit();"></td>
<td align=right>单元间距:
<input type="text" name="cellspace" size="8" maxlength="2" ONKEYPRESS="event.returnValue=IsDigit();"></td>
</tr>
</table>
</fieldset>
</td></tr>
<tr><td>
<fieldset><legend>表格宽度</legend>
<table border=0 cellspacing=0 cellpadding=3 width="100%">
<tr>
<td><input name="widthspecified" id="widthspecified" type="checkbox" class="cb" onClick="checkchange();" value="1" checked><label for="widthspecified">指定表格的宽度</label></td>
<td align="right">
<input name="width" type="text" value="500" size="5" maxlength="3" ONKEYPRESS="event.returnValue=IsDigit();" >
<select name="WidthUnit">
<option selected>像素</option>
<option value="%">百分比</option>
</select></td>
</tr>
</table>
</fieldset>
</td></tr>
<tr><td>
<fieldset><legend>表格颜色</legend>
<table border=0 cellspacing=0 cellpadding=3 width="100%">
<tr>
<td>边框颜色:
<input name='bordercolor' type='text' size="7" maxlength="20" value="#CCCCCC" onchange="colorchange(this,document.all.spanBdColor);">
<img src="images/pickcolor.gif" style="background:#cccccc" align=absmiddle onclick="selColor(bordercolor,this);">
</td>
<td align=right>背景颜色:
<input name='bgcolor' type='text' size="7" maxlength="20" onchange="colorchange(this,document.all.spanBgColor);">
<span id="spanBgColor"><img src="images/pickcolor.gif" align=absmiddle onclick="selColor(bgcolor,document.all.spanBgColor);"></span>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td align="right">
<button type=submit onClick='table();' name="submit"> 确定 </button>
<button onClick='window.close();' name="button"> 取消 </button>
</td></tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -