sdya

<input type="button" onclick="javascript:printit()"></input>//打印整个html网页.

//打印局部html网页 extjs中的例子

 bdhtml = window.document.body.innerHTML;
    startprint = ("<div>");
    endprint = ("</div>");
    printhtml = bdhtml.substr(bdhtml.indexOf(startprint) );
    printhtml = printhtml.substr(0, printhtml.indexOf(endprint));
    window.document.write(\'<html>\');
    window.document.write(\'<head>\');
    window.document.write(\'<title>打印列表</title>\');
    window.document.write(\'</head>\');
    window.document.write(\'<body><from>\');
    window.document.write(printhtml);
    window.document.write(\'<from></body>\');
    window.document.write(\'</html>\');
    window.print();
    window.location.reload();//加载页面

 

分类:

技术点:

相关文章:

  • 2021-11-19
  • 2021-08-31
  • 2021-10-06
  • 2021-12-01
  • 2021-07-05
  • 2021-10-09
  • 2021-04-17
猜你喜欢
  • 2021-09-24
  • 2021-11-24
  • 2021-11-18
  • 2021-11-18
  • 2021-09-28
  • 2021-10-07
  • 2021-10-14
相关资源
相似解决方案