調整字型列印demo

摘要:調整字型列印demo

<script language="javascript">
 
function printsetup(){ 
 // 打印頁面設置 
 wb.execwb(8,1); 

function printpreview(){ 
 // 打印頁面預覽 
 wb.execwb(7,1);                  

 
function  printit(){ 
 if (confirm('確定列印嗎?')){ 
 wb.execwb(6,6) 
 } 

function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
var min=8;
var max=18; 
function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }  
}

</script>
<object id="wb" name="wb" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" width="3" height="0"></object>

<input class="ipt" type="button" onclick="javascript:printit();" name="button_print" value="列印" />

<input class="ipt" type="button" onclick="javascript:printsetup();" name="button_setup" value="設定列頁面設置" />

<input class="ipt" type="button" onclick="javascript:printpreview();" name="button_show" value="列印預覽" />

<input class="ipt" type="button" onclick="javascript:window.close();" name="button_fh" value="關閉視窗" />

<a href="javascript:decreaseFontSize();">-(字變小)</a>
<a href="javascript:increaseFontSize();">+(字變大)</a>
<p>這些東西有些已經被IE限制了!</p>