| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| <html> |
| <head> |
| <style> |
| TD |
| { |
| border: 1px solid; |
| width:75px; |
| } |
| </style> |
| <script> |
| window.onload = windowLoad; |
| |
| function windowLoad() |
| { |
| var newTable = document.createElement("table"); |
| newTable.id = "newTable"; |
| |
| for(var y=0;y<1;y++) |
| |
| { |
| var newRow = newTable.insertRow(y); |
| |
| |
| for( var x=0;x<1;x++) |
| |
| { |
| var newCell = newRow.insertCell(x); |
| |
| newCell.appendChild(document.createTextNode("r" + y + "c" + x)); |
| } |
| } |
| document.body.appendChild(newTable); |
| modify(); |
| insert(); |
| } |
| |
| function modify() |
| { |
| var t = document.getElementById("newTable"); |
| |
| var cell = t.rows[0].cells[0]; |
| |
| cell.firstChild.nodeValue = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| } |
| |
| function insert() |
| { |
| var t = document.getElementById("newTable"); |
| |
| var cell = t.rows[0].cells[0]; |
| |
| cell.firstChild.nodeValue = "aa"; |
| } |
| </script> |
| </head> |
| <body> |
| |
| <form> |
| <input type="button" onclick="modify();" value="(1) Fill cell with long string"><br> |
| <input type="button" onclick="insert();" value="(2) Fill cell with short string"><br> |
| </form> |
| </body> |
| </html> |