<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    javascript打印

    問題:去除頁眉頁腳,設置打印的橫縱向方式!
    解決方案一:
    修改注冊表:
    ??var HKEY_Root,HKEY_Path,HKEY_Key;
    ??HKEY_Root = "HKEY_CURRENT_USER\\";
    ??HKEY_Path="Software\\Microsoft\\Internet Explorer\\PageSetup\\";
    ??
    ??function PageSetup_Null(){
    ???var Wsh = new ActiveXObject("WScript.Shell");
    ???HKEY_Key = "header";
    ???//Wsh.RegRead(HKEY_Root+HKEY_Path+HKEY_Key);
    ???Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
    ???HKEY_Key = "footer";
    ???//Wsh.RegRead(HKEY_Root+HKEY_Path+HKEY_Key);
    ???Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
    ??}
    ??
    ??window.onload=PageSetup_Null();
    ??
    ??function PageSetup_Reset(){
    ???var Wsh = new ActiveXObject("WScript.Shell");
    ???HKEY_Key = "header";
    ???Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b頁碼,&p/&P");
    ???HKEY_Key = "footer";
    ???Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d");
    ??}

    ??window.unonload=PageSetup_Reset();

    由于注冊表位置跟操作系統有關,不推薦使用。

    解決方案二:
    使用控件:
    -------------http://www.7say.com/article.asp?id=112----------
    利用ScriptX.cab控件進行WEB打印,可以控制"縱打"、 橫打”和“頁面的邊距。打印代碼如下:

    <object id=factory viewastext style="display:none"
    classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
    ?codebase="</object>
    <script defer>
    function window.onload() {
    ?// -- advanced features
    ?factory.printing.SetMarginMeasure(2); // measure margins in inches
    ?factory.printing.printer = "HP DeskJet 870C";
    ?factory.printing.paperSize = "A4";
    ?factory.printing.paperSource = "Manual feed";
    ?factory.printing.collate = true;
    ?factory.printing.copies = 2;
    ?factory.printing.SetPageRange(false, 1, 3); // need pages from 1 to 3

    ?// -- basic features
    ?factory.printing.header = "This is MeadCo";
    ?factory.printing.footer = "Advanced Printing by ScriptX";
    ?factory.printing.portrait = false;
    ?factory.printing.leftMargin = 1.0;
    ?factory.printing.topMargin = 1.0;
    ?factory.printing.rightMargin = 1.0;
    ?factory.printing.bottomMargin = 1.0;
    }

    function Print(frame) {
    ?factory.printing.Print(true, frame) // print with prompt
    </script>

    <script language="javascript">
    function printTure() //打印函數
    {
    ?document.all("dayinDiv").style.display="none";//隱藏按鈕
    ?factory.printing.Print(false); //調用控件打印
    ?document.all("dayinDiv").style.display="";//顯示
    }
    </script>

    <DIV align="center" id="dayinDiv" name="dayinDiv">
    <input type=button value="打印本頁" onclick="printTure()">
    <input type=button value="頁面設置" onclick="factory.printing.PageSetup()">
    <input type=button value="打印預覽" onclick="factory.printing.Preview()"><br>
    </DIV>


    關于ScriptX的下載和該控件的使用方法請登陸
    http://www.meadroid.com/scriptx/index.asp 查看.
    -----------------------------------------------
    具體應用:
    ??<object id=factory style="display:none"
    ???classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
    ???codebase="<c:url value="/editor/ScriptX.cab#version=5,60,0,375"/>" viewastext>
    ??</object>

    ??<OBJECT id=WB classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>?

    ??function printit()
    ??{
    ???factory.printing.header?? =?? "";??
    ????? ???factory.printing.footer?? =?? "";??
    ???factory.printing.portrait = false;
    ??  ?WB.ExecWB(6,6)
    ??}
    ??
    ??function setPrint()
    ??{
    ???factory.printing.header?? =?? "";??
    ????? ???factory.printing.footer?? =?? "";??
    ???factory.printing.portrait = false;
    ???WB.ExecWB(8,1);
    ??}
    ??function previewPrint()
    ??{
    ???factory.printing.header?? =?? "";??
    ????? ???factory.printing.footer?? =?? "";??
    ???factory.printing.portrait = false;
    ???WB.ExecWB(7,1)
    ??}

    ??function reset() {
    ???factory.printing.header?? =?? "&w&b頁碼,&p/&P";??
    ????? ???factory.printing.footer?? =?? "&u&b&d";??
    ???factory.printing.portrait = true;
    ??}

    ??window.unonload=reset();

    <DIV align="center" id="dayinDiv" name="dayinDiv">
    <input type=button value="打印本頁" onclick="printit()">
    <input type=button value="頁面設置" onclick="setPrint()">
    <input type=button value="打印預覽" onclick="previewPrint()"><br>
    </DIV>

    posted on 2006-11-14 12:26 扭轉乾坤 閱讀(1175) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2006年11月>
    2930311234
    567891011
    12131415161718
    19202122232425
    262728293012
    3456789

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類(31)

    隨筆檔案(30)

    文章分類(32)

    文章檔案(33)

    相冊

    PHP小站-首頁

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 高h视频在线免费观看| 国产在线精品一区免费香蕉| 亚洲人成电影网站色| 日本精品久久久久久久久免费| 在线免费播放一级毛片| 国产啪亚洲国产精品无码 | 日日摸夜夜添夜夜免费视频| 无码国产精品一区二区免费模式 | 国产精品亚洲一区二区三区久久 | 亚洲av鲁丝一区二区三区| 亚洲精品乱码久久久久蜜桃| 久久国产乱子伦精品免费不卡| 国产一级淫片视频免费看| 亚洲日产2021三区在线| 色播在线永久免费视频网站| 亚洲热妇无码AV在线播放| 国产成人精品日本亚洲语音| 国产免费女女脚奴视频网| 亚洲国产精品一区二区第一页| 久久亚洲AV成人无码国产电影| h视频在线观看免费完整版| 亚洲人色婷婷成人网站在线观看 | 色播精品免费小视频| 亚洲中文字幕人成乱码| 国产精品偷伦视频观看免费| 亚洲国产香蕉人人爽成AV片久久| 亚洲最大天堂无码精品区| 亚洲人成免费网站| 亚洲精品V天堂中文字幕| 亚洲欧洲精品成人久久奇米网| 久久精品电影免费动漫| 亚洲一级毛片中文字幕| 全部免费a级毛片| 99亚洲乱人伦aⅴ精品| 亚洲欧洲国产精品香蕉网| 最近高清中文字幕无吗免费看| 国产精品亚洲专区无码WEB| 亚洲自偷自偷图片| 日韩免费高清播放器| 亚洲韩国精品无码一区二区三区| 久久国产精品免费|