Jangogo :
JScript
- //增加打印必须的CSS,页面加载的时候运行
- try{
- var e__=document.createElement('STYLE');
- e__.setAttribute('type','text/css');
- e__.styleSheet.media='print';
- e__.styleSheet.cssText='.p__{display:none}';
- document.getElementsByTagName('head')[0].appendChild(e__);
- }catch(ex){};
- try{
- var e__=document.createElement('STYLE');
- e__.setAttribute('type','text/css');
- e__.styleSheet.media='screen';
- e__.styleSheet.cssText='#div__pazu__{display:none;}';
- document.getElementsByTagName('head')[0].appendChild(e__);
- }catch(ex){};
- try{
- if(__chkpazu) __chkpazu();
- }catch(ex){};
- //创建一个函数__printElementById,这个函数是PAZU的printElementById方法的JS实现
- var __ep__last;
- function __printElementById(sID){
- if(__ep__last){
- try{
- __ep__last.className=__ep__last.getAttribute('oclass_pazu');
- }catch(ex){};
- }
- var id='div__pazu__';
- var e=document.getElementById(id);
- if(!e){
- e=document.createElement('DIV');
- e.id=id;
- e.style.cssText='overflow:visible;border:0;padding:0;margin:0;';
- document.body.appendChild(e);
- }
- try{
- document.getElementsByTagName('head')[0].removeChild('style__pazu__');
- }catch(ex){};
- var e__=document.createElement('STYLE');
- e__.id='style__pazu__';
- e__.setAttribute('type','text/css');
- e__.styleSheet.media='print';
- e__.styleSheet.cssText='body{background-color:white;}body > *{display:none;}#div__pazu__{background-color:white;}#div__pazu__,.p_p__{display:block;left:0;top:0;}';
- var ep=document.getElementById(sID);
- if(ep.tagName=='IFRAME'){
- ep=window.frames[sID];
- var s='';
- var h=ep.document.styleSheets;
- for(i=0;i<h.length;i++){
- var r=h[i].rules;
- for(j=0;j<r.length;j++){
- var t=(' '+r[j].selectorText+' ').replace(' body ',' #'+id+' ').replace(/(^\s*)|(\s*$)/g,'');
- if(t.indexOf(id)!=1){t='#'+id+' '+t;}
- s=s+t+'{'+r[j].style.cssText+'}';
- }
- }
- e__.styleSheet.media='print';
- e__.styleSheet.cssText+=s;
- e.innerHTML=ep.document.body.innerHTML;
- }else{
- e.innerHTML='';
- var n=ep.className;
- if(!n)n='';
- ep.setAttribute('oclass_pazu',n);
- ep.className=n+' p_p__';
- __ep__last=ep;
- }
- try{
- document.getElementsByTagName('head')[0].appendChild(e__);
- }catch(ex){};
- }
- //
文档中心