///这个是插入table的函数
///Composition是iframe的ID
///table.htm是输入几行几列的窗口function InsertTable()///插入表格
{
var sel=this.selection;
if(!sel)
{
sel=Composition.document.selection.createRange();
sel.type=Composition.document.selection.type;
}
var arr = showModalDialog("table.htm", "", "dialogWidth:18em; dialogHeight:8em; status:0");

if (arr != null)
{
var ss;
ss=arr.split("*")
row=ss[0];
col=ss[1];
if(row==0 || col==0)return;
var strTB;
strTB="<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#333333\" width=\"100\%\">";
for(i=1;i<=row;i++)
{
strTB=strTB+"<tr>";
for(j=1;j<=col;j++)
{
strTB=strTB+"<td></td>";
}
strTB=strTB+"</tr>";
}
strTB=strTB+"</table>";

if(!sel)
{
sel.item(0).outerHTML=strTB;
}
else
{
sel.pasteHTML(strTB);
}
}
else Composition.focus();
}========table.htm=======<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>插入表格</title>
</head>
<SCRIPT event=onclick for=Ok language=JavaScript>
  window.returnValue = selrow.value+"*"+selcol.value
  window.close();
</SCRIPT>
<body bgcolor="cccccc">
  <table width="200" border="0" align="center">
    <tr> 
      <td colspan="2">请输入......</td>
  </tr>
  <tr> 
      <td width="131">行数: 
        <input id="selrow" type="text" size="10"> </td>  
      <td width="59"> <div align="right">
          <input type="button" name="Submit" id="Ok" value="确定">
        </div></td>
  </tr>
  <tr> 
      <td> 列数: 
        <input id="selcol" type="text" size="10"> </td>  
      <td> <div align="right">
          <input type="button" name="Submit2" value="取消" onClick="window.close()";>
        </div></td>
  </tr>
</table>
</body>
</html>