tinguo002

           

          WEB 打印,去頁(yè)碼、隱藏打印按鈕

          詳細(xì)參考: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\\";
                   //設(shè)置網(wǎng)頁(yè)打印的頁(yè)眉頁(yè)腳邊距為空
                   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)入申請(qǐng)</div>
            <div id="frame_content">

             <table class="content">
              <tr>
               <th>收款銀行:</th>
               <td><%=arr[0]%></td>
               <th>收款方全稱:</th>
               <td><%=arr[1]%></td>
              </tr>
              <tr>
               <th>收款方銀行賬號(hào):</th>
               <td><%=arr[2]%></td>
               <th>充值碼:</th>
               <td><%=arr[3]%>(填寫(xiě)在備注欄)</td>
              </tr>
              <tr>
               <th>匯款銀行:</th>
               <td><%=arr[4]%></td>
               <th>匯款方全稱:</th>
               <td><%=arr[5]%></td>
              </tr>
              <tr>
               <th>匯款賬號(hào):</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">
             備注: 請(qǐng)到網(wǎng)銀或者銀行辦理轉(zhuǎn)賬業(yè)務(wù),轉(zhuǎn)賬匯款時(shí),信息必須如實(shí)填寫(xiě),以避免無(wú)法如實(shí)到賬而給您的投資造成損失!</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">建設(shè)銀行</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">郵政儲(chǔ)蓄</a>
               </td>
              </tr>

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

          代碼中所需圖片如下:








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

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

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          收藏夾

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 林州市| 溆浦县| 内丘县| 岳阳县| 剑河县| 库伦旗| 陆河县| 丹凤县| 闽侯县| 尼勒克县| 福建省| 都昌县| 民县| 拉孜县| 西畴县| 丽江市| 宕昌县| 云南省| 民权县| 镇江市| 肥城市| 沈阳市| 峨山| 曲松县| 乳山市| 屏东市| 长沙县| 平南县| 晋中市| 河池市| 景谷| 镇赉县| 凤凰县| 古浪县| 肥西县| 瑞昌市| 保亭| 丹阳市| 大田县| 临沂市| 铜鼓县|