close

chrome 實測正常

頁面的列印:

<a href='#' class='notprint' onclick='pagesetup_null();self.print();'><img src=../images/printer.png border=0 title='列印' ></a>

不列印頁眉頁腳:

<script language="javascript">
var hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="//Software//Microsoft//Internet Explorer//PageSetup//"
function pagesetup_null()
{
try{
var RegWsh = new ActiveXObject("WScript.Shell")
hkey_key="header"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
hkey_key="footer"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
}catch(e){}
}
</script>

某些元素不列印: 未測

<style> 
@media print { 
.notprint { 
display:none; 
} 
} 
 
@media screen { 
.notprint { 
display:inline; 
cursor:hand; 
} 
}
</style>
來源網址
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jason0324 的頭像
    jason0324

    Js 片段記憶回顧中心

    jason0324 發表在 痞客邦 留言(0) 人氣()