读书人

jsp页面打印、预览、设立实现方案

发布时间: 2012-10-25 10:58:58 作者: rapoo

jsp页面打印、预览、设置实现方案

1 、print.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><SCRIPT language=javascript>    var printSetup = function(){      // 打印页面设置      wb.execwb(8,1);    }    var printPreView = function(){      // 打印页面预览            wb.execwb(7,1);          }    var printIt = function(){      if (confirm('确定打印吗?')) {      //wb.execwb(6,6)   ;    window.print();//update by liuguocheng   }    }var windowClose = function(){window.opener=null; window.open('','_self'); window.close();};</SCRIPT><style type="text/css" media=print>.Noprint{display : none }</style><center height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" name="wb"></OBJECT><input type=button value="打印" onclick="printIt()">      <input type=button value="预览" onclick="printPreView()">      <input type=button value="设置" onclick="printSetup()">   <input type=button value="关闭" onClick="windowClose()">  <br/></p></center>

?

2、要打印的jsp页面

<%@ page contentType="text/html; charset=utf-8" language="java"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>打印</title><%@include file="print.jsp"%></head><body><!-- 打印内容 --></body></html>

?

?

读书人网 >JavaScript

热点推荐