Javascript简单打印与导出
<script language="JavaScript">
function PrintTable(Id){
var mStr;
mStr = window.document.body.innerHTML ;
var mWindow = window;
window.document.body.innerHTML =Id.innerHTML;
mWindow.print();
window.document.body.innerHTML = mStr;
}
function PrintTable(Id){
var mStr;
mStr = window.document.body.innerHTML ;
var mWindow = window;
window.document.body.innerHTML =Id.innerHTML;
mWindow.print();
window.document.body.innerHTML = mStr;
}
function saveas(Id){
var mStr;
mStr = window.document.body.innerHTML ;
var mWindow = window;
window.document.body.innerHTML =Id.innerHTML;
document.write(window.document.body.innerHTML);
document.execCommand("saveAs","1","查询结果.xls");
window.document.body.innerHTML = mStr;
history.back();
}
</script>
var mStr;
mStr = window.document.body.innerHTML ;
var mWindow = window;
window.document.body.innerHTML =Id.innerHTML;
document.write(window.document.body.innerHTML);
document.execCommand("saveAs","1","查询结果.xls");
window.document.body.innerHTML = mStr;
history.back();
}
</script>