当前位置: 代码迷 >> Ajax >> jquery PrintArea 打印指定区域有关问题?为啥指定不了,打印出来还是一整页,为什么?
  详细解决方案

jquery PrintArea 打印指定区域有关问题?为啥指定不了,打印出来还是一整页,为什么?

热度:403   发布时间:2012-03-30 17:32:10.0
jquery PrintArea 打印指定区域问题?为啥指定不了,打印出来还是一整页,为什么? - Web 开发 / Ajax
jquery PrintArea 打印指定区域问题?为啥指定不了,打印出来还是一整页,为什么?
HTML code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.hzj.portal.student.vo.money"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ page import="java.util.*"%>

<html> 
    <head>
        <title>现金交接表</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="${portal}/css/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="${portal}/css/index.css">
        <link rel="stylesheet" type="text/css" href="../css/icon.css">
        <script type="text/javascript" src="${portal}/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="${portal}/js/jquery.easyui.min.js"></script>                  
         <script type="text/javascript" src="${portal}/js/calendar/WdatePicker.js"></script>    
        <script type="text/javascript" src="${portal}/js/PrintArea.js"></script>
 <script>
    $("a#PrintArea").click(function(){
      $("span.PrintArea").printArea( {popX: 500, popY: 400,popTitle:'现金交接'});
    });
</script>
</head>
    <body style="text-align:center;">
        <!--startprint-->
        <div id="print" class="easyui-window" title="现金交接"
            iconCls="icon-save"
            style="width: 980px; height: 450px; padding: 5px;top:10px; background: #fafafa;" modal="false" shadow="false" maximizable="false" collapsible="false" closed="false" minimizable="false">
            <div  class="easyui-layout" fit="true" >
                <div region="center" border="false"
                    style="padding: 10px; background: #fff; border: 1px solid #ccc;">
                      <!--想从这开始打印,上面的部分不打印,但现在上面的部份还是打印了-->
                     <span  id="PrintArea">                                  <table width="443" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td height="50" align="center" id="fp_title">现金交接表</td>
                        </tr>
                      </table>
         <table width="620" border="0" cellpadding="0" cellspacing="1" bordercolor="#000000" bgcolor="#000000">
        <tr>
        <td width="61" height="40" align="center" bgcolor="#FFFFFF">交易量</td>
        <td width="94" align="center" bgcolor="#FFFFFF">学费累计</td>
        <td width="82" align="center" bgcolor="#FFFFFF">教材费累计</td>
        <td width="58" align="center" bgcolor="#FFFFFF" >总计</td>
        <td width="101" align="center" bgcolor="#FFFFFF" >日期</td>
        <td width="85" align="center" bgcolor="#FFFFFF" >经办人</td>
        </tr>
    <c:forEach  items="${indexList}" var="index">
    <tr>
    <td height="40" align="center" bgcolor="#FFFFFF" id="pr_student_sfh"> ${index.money_id }</td>
    <td align="center" bgcolor="#FFFFFF" id="pr_km">${index.money_studentid }</td>
    <td align="center" bgcolor="#FFFFFF" id="pr_type_name">${index.money_zffs }</td>
         <td align="center" bgcolor="#FFFFFF" id="pr_student_xfss">${index.money_type }</td>
    <td align="center" bgcolor="#FFFFFF" id="pr_jcf">${index.money_key }</td>
    <td align="center" bgcolor="#FFFFFF" id="pr_jcf">${index.money_fs }</td>
    </tr>
          </c:forEach>
         </table>
        <table width="612" border="0" cellspacing="0">
           <tr><td height="50" colspan="6" align="center" id="pr_hj"><p>合计:<%=request.getAttribute("hj_xx")%>元         (大写:<%=request.getAttribute("hj_dx") %>元整) </p></td></tr>
          <tr>
                            <td width="70" height="40" align="center">经办人:</td>
                            <td width="112" height="40" align="left"><%=request.getAttribute("hj_qm") %></td>
                            <td width="115" height="40" align="center">经办日期:</td>
                            <td width="259" height="40" align="left"><%=request.getAttribute("hj_rq") %></td>
                            <td width="109" height="40" align="left"> 接收人签字:</td>
                            <td width="94" height="40" align="center"></td>
                          </tr>
                  </table>
                  
                  </span>
             <!--打印结束位置,以下部分不需要打印-->     
                <!--endprint-->


                                   </div>
                <div region="south" border="false"
                    style="text-align: right; height: 30px; line-height: 30px;">
                    <a class="easyui-linkbutton" iconCls="icon-ok"
                        href="javascript:void(0)" onClick="print()">打印</a>
                </div>
            </div>
        </div>
    
        
        <p>            
    </body>
</html>







 
  相关解决方案