zoukankan      html  css  js  c++  java
  • 打印选中的网页

     //把需要打印的代码,替换掉body中的内容,执行window.print()方法
    document.getElementsByTagName("body")[0].style.overflow='auto' // this.$print(this.$refs.print) var arr=document.getElementsByClassName('v-transfer-dom') arr.forEach(function(item){ item.style.display='none' }) var tables=document.getElementsByTagName('table'); tables.forEach(function(item){ item.style.width='100%' item.setAttribute('width','100%'); }) var td=document.getElementsByTagName('td'); td.forEach(function(item){ item.style.width='auto' item.setAttribute('width','auto'); }) setTimeout(function(){ document.getElementById('app1').innerHTML="" document.getElementById('app1').appendChild((document.getElementById('print').cloneNode(true))) window.print(); window.location.reload(); })
  • 相关阅读:
    (转)IDEA ERROR:找不到或无法加载主类
    Piggy-Bank
    Monkey and Banana
    Max Sum Plus Plus
    Doing Homework
    繁繁的游戏
    看试卷
    繁繁的队列
    大整数乘法
    文件操作(c++)
  • 原文地址:https://www.cnblogs.com/liuhao-web/p/12858090.html
Copyright © 2011-2022 走看看