Mozilla/mozilla/layout/html/tests/TableIncrementalReflow.html
buster%netscape.com a53203e2ef nsTableFrame can now incrementally insert, append, and delete colgroups
git-svn-id: svn://10.0.0.236/trunk@12839 18797224-902f-48f8-a5cc-f745e15eee43
1998-10-14 22:51:50 +00:00

136 lines
4.2 KiB
HTML

<HTML>
<HEAD>
<SCRIPT>
function insertCaption() {
var table = document.getElementsByTagName("TABLE")[0];
var caption = document.createElement("CAPTION", null);
var text = document.createTextNode("here is the new caption text");
caption.appendChild(text);
table.appendChild(caption);
}
function deleteCaption() {
var table = document.getElementsByTagName("TABLE")[0];
var caption = document.getElementsByTagName("CAPTION")[0];
table.removeChild(caption);
}
function insertColGroup() {
var table = document.getElementsByTagName("TABLE")[0];
var refColGroup = document.getElementsByTagName("COLGROUP")[0];
var colGroup = document.createElement("COLGROUP", null);
colGroup.width=200;
colGroup.span=1;
table.insertBefore(colGroup, refColGroup);
dump("inserted COLGROUP with span=1 width=200 as first colgroup in table");
}
function appendColGroup() {
var table = document.getElementsByTagName("TABLE")[0];
var colGroup = document.createElement("COLGROUP", null);
colGroup.width=300;
colGroup.span=1;
table.appendChild(colGroup);
dump("appended COLGROUP with span=1 width=300");
}
function deleteColGroup() {
var table = document.getElementsByTagName("TABLE")[0];
var colGroup = document.getElementsByTagName("COLGROUP")[0];
table.removeChild(colGroup);
}
function insertCol() {
var table = document.getElementsByTagName("TABLE")[0];
var refCol = table.getElementsByTagName("COL")[0];
var col = document.createElement("COL", null);
col.width=200;
col.span=1;
table.insertBefore(col, refCol);
dump("inserted COL with span=1 width=200 as first col in first col group");
}
function appendCol() {
var table = document.getElementsByTagName("TABLE")[0];
var col = document.createElement("COL", null);
table.appendChild(col);
dump("appended COL with span=1 width=300");
}
function deleteCol() {
var table = document.getElementsByTagName("TABLE")[0];
var col = document.getElementsByTagName("COL")[0];
table.removeChild(col);
}
function insertRowGroup() {
var table = document.getElementsByTagName("TABLE")[0];
var rowGroup = document.createElement("TBODY", null);
table.appendChild(rowGroup);
}
function deleteRowGroup() {
var table = document.getElementsByTagName("TABLE")[0];
var rowGroup = document.getElementsByTagName("TBODY")[0];
table.removeChild(rowGroup);
}
function insertRow() {
var table = document.getElementsByTagName("TABLE")[0];
var row = document.createElement("TR", null);
table.appendChild(row);
}
function deleteRow() {
var table = document.getElementsByTagName("TABLE")[0];
var row = document.getElementsByTagName("TR")[0];
table.removeChild(row);
}
</SCRIPT>
</HEAD>
<BODY>
all insert buttons currently do an append
all delete buttons currently remove the first item of <type> found
<table border>
<tbody>
<tr>
<td>cell content</td>
</tr>
</tbody>
</table>
<p>
<form>
<INPUT TYPE="button" NAME="Ins Caption" VALUE="InsertCaption" onClick="insertCaption()" width=100>
<INPUT TYPE="button" NAME="Del Caption" VALUE="DeleteCaption" onClick="deleteCaption()" width=100>
<br>
<INPUT TYPE="button" NAME="Ins ColGroup" VALUE="InsertCG" onClick="insertColGroup()" width=100>
<INPUT TYPE="button" NAME="App ColGroup" VALUE="AppendCG" onClick="appendColGroup()" width=100>
<INPUT TYPE="button" NAME="Del ColGroup" VALUE="DeleteCG" onClick="deleteColGroup()" width=100>
<br>
<INPUT TYPE="button" NAME="Ins Col" VALUE="InsertCol" onClick="insertCol()" width=100>
<INPUT TYPE="button" NAME="App Col" VALUE="AppendCol" onClick="appendCol()" width=100>
<INPUT TYPE="button" NAME="Del Col" VALUE="DeleteCol" onClick="deleteCol()" width=100>
<br>
<INPUT TYPE="button" NAME="Ins RowGroup" VALUE="InsertRG" onClick="insertRowGroup()" width=100>
<INPUT TYPE="button" NAME="App RowGroup" VALUE="AppendRG" onClick="appendRowGroup()" width=100>
<INPUT TYPE="button" NAME="Del RowGroup" VALUE="DeleteRG" onClick="deleteRowGroup()" width=100>
<br>
<INPUT TYPE="button" NAME="Ins Row" VALUE="InsertRow" onClick="insertRow()" width=100>
<INPUT TYPE="button" NAME="App Row" VALUE="AppendRow" onClick="appendRow()" width=100>
<INPUT TYPE="button" NAME="Del Row" VALUE="DeleteRow" onClick="deleteRow()" width=100>
<br>
</form>
</BODY></HTML>