tinguo002

           

          WEB 打印,去頁碼、隱藏打印按鈕

          詳細參考:http://www.cnblogs.com/aidd2008/archive/2012/04/25/2469994.html

          JSP代碼如下:

          <%@page import="java.net.URLDecoder"%>
          <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
          <%
           String path = request.getContextPath();
           String basePath = request.getScheme() + "://"
             + request.getServerName() + ":" + request.getServerPort()
             + path + "/";
           String params = request.getParameter("params");
           params = URLDecoder.decode(params, "UTF-8");
           String[] arr = new String[8];
           if (params != null) {
            arr = params.split(",");
           }
           request.setAttribute("arr", arr);
          %>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html>
          <head>
          <base href="<%=basePath%>">

          <meta http-equiv="pragma" content="no-cache">
          <meta http-equiv="cache-control" content="no-cache">
          <meta http-equiv="expires" content="0">
          <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
          <meta http-equiv="description" content="This is my page">
          <!--
           <link rel="stylesheet" type="text/css" href="styles.css">
           -->
          <style media=print>
          .Noprint {
           display: none;
          }

          .PageNext {
           page-break-after: always;
          }

          </style>
          <style type="text/css">
          .helpSpan{ 
           margin-left:20px;
           cursor:pointer;
           display:inline-block;
           color:blue;
          }
          </style>
          <script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script>
          <title>打印單</title>
          <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
          <link rel="stylesheet" type="text/css"
           href="css/gzjrzcjys/editFrame.css" />
           <script type="text/javascript">
            function print1(){
             document.all.WebBrowser.ExecWB(6,6);
            }
            function wOpen(){
             $("span.open").hide();
             $("span.close").show();
             $("#helpContent").show();
            }
            function wClose(){
             $("span.open").show();
             $("span.close").hide();
             $("#helpContent").hide();
            }
             var hkey_root, hkey_path, hkey_key;
                   hkey_root = "HKEY_CURRENT_USER";
                   hkey_path = "
          \\software\\Microsoft\\Internet Explorer\\PageSetup\\";
                   //設置網(wǎng)頁打印的頁眉頁腳邊距為空
                   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, "");
                           hkey_key = "margin_left";
                           RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                           hkey_key = "margin_right";
                           RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                           hkey_key = "margin_top";
                           RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                           hkey_key = "margin_bottom";
                           RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                       } catch (e) {
                        alert(e);
                       }
                   }

            $(document).ready(function(){
             pagesetup_null();
            });
           </script>
          </head>

          <body>
           <div id="frame">
            <div id="frame_title">線下資金轉(zhuǎn)入申請</div>
            <div id="frame_content">

             <table class="content">
              <tr>
               <th>收款銀行:</th>
               <td><%=arr[0]%></td>
               <th>收款方全稱:</th>
               <td><%=arr[1]%></td>
              </tr>
              <tr>
               <th>收款方銀行賬號:</th>
               <td><%=arr[2]%></td>
               <th>充值碼:</th>
               <td><%=arr[3]%>(填寫在備注欄)</td>
              </tr>
              <tr>
               <th>匯款銀行:</th>
               <td><%=arr[4]%></td>
               <th>匯款方全稱:</th>
               <td><%=arr[5]%></td>
              </tr>
              <tr>
               <th>匯款賬號:</th>
               <td><%=arr[6]%></td>
               <th>匯款金額:</th>
               <td><%=arr[7]%>&nbsp;元</td>
              </tr>
             </table>


            </div>
            <div id="frame_bottom" class="Noprint">
             <a href="javascript:void(0)" class="button_toRound"><span
              style="font-size:14px;"
              onclick="print1()" class="Noprint">【打印】</span>
             </a>
            </div>
            <div style="padding:12px 5px;background-color:#ffffff" class="Noprint">
             備注: 請到網(wǎng)銀或者銀行辦理轉(zhuǎn)賬業(yè)務,轉(zhuǎn)賬匯款時,信息必須如實填寫,以避免無法如實到賬而給您的投資造成損失!</div>
           </div>

           <div style="width:750px;margin:auto;margin-top:150px;" class="Noprint">
            <div>友情鏈接:</div>
            <div>
             <table class="content">
              <tr>
               <td><a href="     </td>
               <td><a href="
                target="_blank">建設銀行</a>
               </td>
               <td><a href="
               </td>
               <td><a href="
               </td>
              </tr>
              <tr>
               <td><a href="
                target="_blank">光大銀行</a>
               </td>
               <td><a
                href="
                target="_blank">交通銀行</a>
               </td>
               <td><a href="
                target="_blank">興業(yè)銀行</a>
               </td>
               <td><a href="
                target="_blank">郵政儲蓄</a>
               </td>
              </tr>

             </table>
            </div>
           </div>
           <div style="width:750px;margin:auto;margin-top:50px;" class="Noprint">
            <div>幫助:點擊【打印】按鈕沒有反應。<span class="open helpSpan"  onclick="wOpen()">&gt;&gt;&gt;展開</span><span onclick="wClose()" class="close helpSpan" style="display:none;">&lt;&lt;&lt;收起</span></div>
            <div id="helpContent" style="display:none;">
             <p>需要將本站點添加為信任站點。共分為三步。</p>
             <p>第一步:打開IE瀏覽器的 Intenet選項</p>
             <div><img src="<%=path%>/images/open_Intenet_ie8.jpg"/></div>
             <p>或者</p>
             <div><img src="<%=path%>/images/open_Intenet_ie11.jpg"/></div>
             <p style="margin-top:20px;">第二步:添加信任站點</p>
             <div><img src="<%=path%>/images/setXinren_ie11.jpg"/></div>
             <p style="margin-top:20px;">第三步:允許控件運行</p>
             <div><img src="<%=path%>/images/setActive.jpg"/></div>
            </div>
           </div>
           <!--endprint-->
          </body>
          </html>

          代碼中所需圖片如下:








          歡迎大家訪問我的個人網(wǎng)站 萌萌的IT人

          posted on 2014-06-28 21:49 一堣而安 閱讀(453) 評論(0)  編輯  收藏 所屬分類: js_css

          導航

          統(tǒng)計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          收藏夾

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 伊宁县| 开远市| 大同县| 木里| 嘉善县| 桦南县| 嘉黎县| 连江县| 洛南县| 东丽区| 安阳县| 亚东县| 城固县| 兴隆县| 安庆市| 西丰县| 辽宁省| 乌兰察布市| 德阳市| 淅川县| 郯城县| 邵东县| 珲春市| 凉城县| 武山县| 湖北省| 木兰县| 安顺市| 晋州市| 瑞昌市| 日土县| 安达市| 鄢陵县| 凤翔县| 抚宁县| 东丰县| 汝城县| 电白县| 弥渡县| 岚皋县| 仁布县|