CopyCode The Code is as follows: <Table id = "printa" width = "100%" border = "1" cellspacing = "0" cellpadding = "0" bgcolor = "#61ff13">
<Tr style = "text-align: center;">
<TD> cell a </TD>
<TD> cell a </TD>
<TD> cell a </TD>
<TD> cell a </TD>
</Tr>
<Tr>
<TD colspan = 4 style = "text-align: center; "> <font color =" blue "face =" verdana "> cell merge Row A </font> </TD>
</Tr>
</Table>
<Table id = "printb" width = "100%" border = "1" cellspacing = "0" cellpadding = "0">
<Tr style = "text-align: center;">
<TD> cell B </TD>
<TD> cell B </TD>
<TD> cell B </TD>
<TD> cell B </TD>
</Tr>
<Tr>
<TD colspan = 4 style = "text-align: center;"> cell merge Row B </TD>
</Tr>
</Table>
<Br/>
<Input type = "button" onclick = "javascript: allareaword ();" value = "export the content of the specified area on the page to word">
<Input type = "button" onclick = "javascript: allareaexcel ();" value = "export the content of a specified area on the page to excel">
<Input type = "button" onclick = "javascript: cellareaexcel ();" value = "export the content of a form cell to excel">
<Script language = "JavaScript">
// Import the content of the specified page area to excel
Function allareaexcel ()
{
VaR oxl = new activexobject ("Excel. application ");
VaR owb = oxl. workbooks. Add ();
VaR osheet = owb. activesheet;
VaR sel = Document. Body. createTextRange ();
Sel. movetoelementtext (printa );
Sel. Select ();
Sel.exe ccommand ("copy ");
Osheet. paste ();
Oxl. Visible = true;
}
// Specify the "cell" content in the page area to import to excel
Function cellareaexcel ()
{
VaR oxl = new activexobject ("Excel. application ");
VaR owb = oxl. workbooks. Add ();
VaR osheet = owb. activesheet;
VaR lenr = printa. Rows. length;
For (I = 0; I <lenr; I ++)
{
VaR lenc = printa. Rows (I). cells. length;
For (j = 0; j <lenc; j ++)
{
Osheet. cells (I + 1, J + 1). value = printa. Rows (I). cells (j). innertext;
}
}
Oxl. Visible = true;
}
// Import the content of the specified page area to the word
Function allareaword ()
{
VaR owd = new activexobject ("word. application ");
VaR ODC = owd. Documents. Add );
VaR Orange = ODC. Range (0, 1 );
VaR sel = Document. Body. createTextRange ();
Sel. movetoelementtext (printa );
Sel. Select ();
Sel.exe ccommand ("copy ");
Orange. paste ();
Owd. application. Visible = true;
// Window. Close ();
}
</SCRIPT>