Enter several input boxes on the page to determine the location of the generated table.
< Script >
Function Testsecond ()
{
VaR Div = Document. getelementbyid ( " Div " );
VaR Table = Document. createelement ( " Table " );
Table. Border = 1 ;
VaR Xnum = Document. getelementbyid ( " Textx " ). Value;
VaR Ynum = Document. getelementbyid ( " Texty " ). Value;
VaR Textrow = Document. getelementbyid ( " Textrow " );
VaR Textcell = Document. getelementbyid ( " Textcell " );
For ( VaR I = 0 ; I < Textrow. value; I ++ )
{
VaR Row = Table. insertrow ();
For ( VaR J = 0 ; J < Textcell. value; j ++ )
{< br> var cell = row. insertcell ();
cell. innertext = " *** " ;< br> cell. width = 50 ;< BR >}
}
Div. style. Left = Xnum;
Div. style. Top = Ynum;
Div. innertext = "" ;
Div. appendchild (table );
}
</ Script > 1 < Form ID = "Form1" Method = "Post" Runat = "Server" >
2 < Table Align = "Center" >
3 < Tr >
4 < TD > Number of rows: </ TD >
5 < TD > < Input Type = "Text" ID = "Textrow" />
6 </ TD >
7 </ Tr >
8 < Tr >
9 < TD > Number of columns: </ TD >
10 < TD > < Input Type = "Text" ID = "Textcell" />
11 </ TD >
12 </ Tr >
13 < Tr >
14 < TD > Coordinate X: </ TD >
15 < TD > < Input Type = "Text" ID = "Textx" />
16 </ TD >
17 </ Tr >
18 < Tr >
19 < TD > Coordinate Y: </ TD >
20 < TD > < Input Type = "Text" ID = "Texty" />
21 </ TD >
22 </ Tr >
23 < Tr >
24 < TD Align = "Center" Colspan = "2" > < Input Type = "Button" Value = "Generate table" Onclick = "Testsecond ();" /> </ TD >
25 </ Tr >
26 </ Table >
27 < P >
28
29 < Div ID = "Div" Style = "Position: absolute ;" >
30 </ Div >
31
32 </ Form >