Using JavaScript to dynamically generate a table is unavoidable. Because it takes a lot of time to redraw a table. If the window changes, unexpected format changes will occur. So it is best not to use it.
Add a <Div id = 'divtable'> </div> in <form> to use JavaScript code to do this:
Function createtable (divname)
...{
VaR DIV = Document. getelementbyid (divname );
VaR table = Document. createelement ("table"); // create a table
VaR ROW = table. insertrow (); // create a row
VaR cell = table. insertcell (); // create a unit
Cell. width = "10"; // modify cell attributes
Cell. style. backgroundcolor = "#999999 ";
}
You can also use your imagination to dynamically create various controls. The above function is placed in the JS file.
If you call <SCRIPT type = "..." src = "*. js"> </SCRIPT>
Here we have created a table element, but it has not been loaded into the DIV layer.
We recommend that you do not use Div. innerhtml or Div. innertext.
Use Div. appendchild (table );