JS方法:
<script type="text/javascript">
function excelPrint(objStr){
var tempStr = document.getElementById('sort_table').outerHTML;
var newWin = window.open();
newWin.document.write(tempStr);
newWin.document.close();
newWin.document.execCommand('saveas',true,objStr+'.xls');
newWin.window.close();
}
</script>
调用:
<input type="button" name="button2" value="导出EXCEL表格" onclick="excelPrint('13838325555,01月01日--01月25日详单');" style="cursor:hand"/>
<script type="text/javascript">
function excelPrint(objStr){
var tempStr = document.getElementById('sort_table').outerHTML;
var newWin = window.open();
newWin.document.write(tempStr);
newWin.document.close();
newWin.document.execCommand('saveas',true,objStr+'.xls');
newWin.window.close();
}
</script>
调用:
<input type="button" name="button2" value="导出EXCEL表格" onclick="excelPrint('13838325555,01月01日--01月25日详单');" style="cursor:hand"/>