js打印局部内容

<script language="javascript">  
function printdiv(printpage)  
{  
var headstr = "<html><head><title></title></head><body>";  
var footstr = "</body>";  
var printData = document.getElementById("dvData").innerHTML; 获得 div 里的所有 html 数据
var oldstr = document.body.innerHTML;  
document.body.innerHTML = headstr+newstr+footstr;  
window.print();  
document.body.innerHTML = oldstr;  
return false;  
}

Tagged: ,

Comments are closed.