• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 巧妙實現隱藏不想打印的web頁面元素

    發表于:2007-06-21來源:作者:點擊數: 標簽:
    HTMLHEADTITLEweb打印去掉頁眉頁腳,以及不想打印出的頁面元素/TITLE META http-equiv=Content-Type content="text/html; charset=gb2312" SCRIPT language= java script function printpr() //預覽函數 { document.all("qingkongyema").click();//打印之前

       
      <HTML><HEAD><TITLE>web打印去掉頁眉頁腳,以及不想打印出的頁面元素</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <SCRIPT language=javascript>

    function printpr()   //預覽函數
    {
    document.all("qingkongyema").click();//打印之前去掉頁眉,頁腳
    document.all("dayinDiv").style.display="none"; //打印之前先隱藏不想打印輸出的元素(此例中隱藏“打印”和“打印預覽”兩個按鈕)
    var OLECMDID = 7;
    var PROMPT = 1;
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
    document.all("dayinDiv").style.display="";//打印之后將該元素顯示出來(顯示出“打印”和“打印預覽”兩個按鈕,方便別人下次打?。?br />}

    function printTure()   //打印函數
    {
        document.all('qingkongyema').click();//同上
        document.all("dayinDiv").style.display="none";//同上
        window.print();
        document.all("dayinDiv").style.display="";
    }
    function doPage()
    {
        layLoading.style.display = "none";//同上
    }


    </SCRIPT>


    <script language="VBScript">
    dim hkey_root,hkey_path,hkey_key
    hkey_root="HKEY_CURRENT_USER"
    hkey_path="\Software\Microsoft\Inte.net Explorer\PageSetup"
    '//設置網頁打印的頁眉頁腳為空
    function pagesetup_null()
    on error resume next
    Set RegWsh = CreateObject("WScript.Shell")
    hkey_key="\header"
    RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
    hkey_key="\footer"
    RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
    end function
    '//設置網頁打印的頁眉頁腳為默認值
    function pagesetup_default()
    on error resume next
    Set RegWsh = CreateObject("WScript.Shell")
    hkey_key="\header"
    RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b頁碼,&p/&P"
    hkey_key="\footer"
    RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
    end function
    </script>


    </HEAD>
    <BODY background="images/background_01.gif" leftMargin=0
    topMargin=0 rightMargin=0 bottomMargin=0 style="BACKGROUND-POSITION: center 50%">


    <DIV align=center>
     
     你希望打印的內容..........
     </DIV>


    <DIV align="center" id="dayinDiv" name="dayinDiv"><input type="button" class="tab" value="打印" onclick="printTure();">&nbsp;&nbsp;
    <input  type="button" class="tab" value="打印預覽" onclick="printpr();">
    <input type="hidden" name="qingkongyema" id="qingkongyema" class="tab" value="清空頁碼" onclick="pagesetup_null()">&nbsp;&nbsp;
    <input type="hidden" class="tab" value="恢復頁碼" onclick="pagesetup_default()">
    </DIV>


    </BODY>
    </HTML>

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>