<
script
language
="javascript"
>
function tableToExcel() {
window.clipboardData.setData( " Text " ,document.all( ' theObjTable ' ).outerHTML);
try
{
var ExApp = new ActiveXObject( " Excel.Application " )
var ExWBk = ExApp.workbooks.add()
var ExWSh = ExWBk.worksheets( 1 )
ExApp.DisplayAlerts = false
ExApp.visible = true
}
catch (e)
{
alert( " 您的电脑没有安装Microsoft Excel软件! " )
return false
}
ExWBk.worksheets( 1 ).Paste;
}
</ script >
< table id =theObjTable >
< tr >
< td > a </ td >
< td > b </ td >
</ tr >
</ table >
< input type ="button" value ="导入到excel" onclick ="tableToExcel()" >
function tableToExcel() {
window.clipboardData.setData( " Text " ,document.all( ' theObjTable ' ).outerHTML);
try
{
var ExApp = new ActiveXObject( " Excel.Application " )
var ExWBk = ExApp.workbooks.add()
var ExWSh = ExWBk.worksheets( 1 )
ExApp.DisplayAlerts = false
ExApp.visible = true
}
catch (e)
{
alert( " 您的电脑没有安装Microsoft Excel软件! " )
return false
}
ExWBk.worksheets( 1 ).Paste;
}
</ script >
< table id =theObjTable >
< tr >
< td > a </ td >
< td > b </ td >
</ tr >
</ table >
< input type ="button" value ="导入到excel" onclick ="tableToExcel()" >