<div class="codetitle"> <span><a style="CURSOR: pointer" data="98312" class="copybut" id="copybut98312" onclick="doCopy('code98312')"><u>複製代碼</u></a></span>如下代號:</div> <div class="codebody" id="code98312"> <br>渡//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><br><br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><title> ;無標題文件</title> <br><link rel="stylesheet" href="tab.css"> <br><script type="text/javascript" src="../Day26%20/doctool.js"></script><br><script type="text/javascript"><BR>function createTab1()<BR>{<BR> var tabNode = doc.createElement("table ");<BR> ");<BR> var trNode = doc.createElement("tr");<BR> var tdNode = doc.createElement("td");<BR> var textNode = doc.create? <BR> tdNode.appendChild(textNode);<BR> trNode.appendChild(tdNode);<BR> tbdNode.Node ); [ 0].appendChild(tabNode);<BR>}<BR>function createTab()<BR>{<BR> var tabNode = doc.createElement("table ");<BR> var tabNode = doc.createElement("table ");<BR> var tabNode = doc.createElement("table ");<BR> ;<BR> tabNode.setAttribute("id","tabid");<BR> var row = byName("rownum")[0].value; <BR> var col = byName("colnum"")[0] .value;<BR> for(var x=1; x<=行; x )<BR> {<BR> var trNode = tabNode.insertRow();< ; y )<BR> {<BR> var tdNode = trNode.insertCell() ;<皮 }<BR> }<BR> byTag("div ")[0].appendChild(tabNode);<BR> event.srcElement.停用= true;<BR>}<BR>function delRow()<BR>{<BR> <BR> if(tabNode==null)<BR> {<BR> 警告("表格不存在");<BR> delrow")[0] .value;<BR> if(rownum>0 && rownum<=tabNode.rows .length)<BR> tabNode.deleteRow(rownum-1);<> alert("刪除的行存在學習數數很重要");<BR> }<BR> }<BR>function delCol()<BR>{<BR> var tabNode = byId("tabid");<BR> var tabNode = byId("tabid");<BR> Node =null)<BR> {<BR> alert("表格不存在") ;<BR> return;<BR> if (colnum>0 && colnum<=tabNode.rows[0].cells.length )<BR> {<BR> for(var x=0;x<tab tabNode.rows[x].deleteCell(colnum-1);<BR> } <BR> }<BR> }<BR>}<BR></script><br>; <br><br><!--<BR>透過頁面的按鈕可以動態的建立一個表格。 <BR>--><br>行:<input type="text" name="rownum"><br>><br>列:<input type="text" name="colnum">gt;<br><input type="button " value="建立表格" onclick="createTab()"><br><br><input type="text" name="delrow"><br><input type="button" value="刪除行" onclick="delRow()"><br><br><br><input type="text" name="delcol"> <br> <input type="button" value="刪除欄位" onclick="delCol()"><br><br><br><br>gt;<br><div> <br> </div> <br><br><br><br> </div>