首页 > 代码库 > 自定义打印

自定义打印

 1 printEvent:function(e){
 2             var layoutCol3 = document.getElementById("layoutCol3");
 3                 var oPop = window.open(‘‘,‘oPop‘);  
 4                 var str = ‘<!DOCTYPE html> 5                     str +=‘<html> 6                     str +=‘<head> 7                     str +=‘<meta charset="utf-8"> 8                     str +=‘<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 9                     str+=‘<style>‘;  
10                     str+=‘#layoutCol3 div{width: 100px;height: 100px;border:1px solid #c50000;}‘;  
11                     str+=‘</style>‘;  
12                     str +=‘</head>13                     str +=‘<body>14                     str +=layoutCol3.innerHTML;  
15                     str +=‘</body>16                     str +=‘</html>17                 
18                 oPop.document.write(str);  
19                 oPop.print();  
20                 oPop.close(); 
21            
22         }

 

自定义打印