webbrowser分页打印
<html:html lang= "true ">
<head>
<html:base />
<title> paper_photo.jsp </title>
<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 type= "text/css " rel= "stylesheet " href= "../css/forum.css ">
<style media=print>
.Noprint{display:none;}
a:link{ text-decoration: none;}
A:HOVER {TEXT-DECORATION:NONE;}
a.visited {text-decoration:none;}
.PageNext{page-break-after:always;}
</style>
<script language= "JavaScript ">
<!--
var temp= ' <%=request.getAttribute( "slave ")%> ';
if(temp!= " "){
var myImages =temp.split( "; ");
}
var index= ' <%=request.getAttribute( "count ")%> ';
index-=1;
function previous(){
index--;
if(index> =0){
document.images[ "tp "].src= ' <%=request.getContextPath()%> /upload/ '+ myImages[index];
document.forms(0).jumpPage.value--;
}else{
index=myImages.length-1;
document.images[ "tp "].src= ' <%=request.getContextPath()%> /upload/ '+ myImages[index];
document.forms(0).jumpPage.value=myImages.length;
}
return false;
}
function next(){
index++;
if(index <myImages.length){
document.images[ "tp "].src= ' <%=request.getContextPath()%> /upload/ ' + myImages[index];
document.forms(0).jumpPage.value++;
}else{
index=0;
document.images[ "tp "].src= ' <%=request.getContextPath()%> /upload/ '+myImages[index];
document.forms(0).jumpPage.value=1;
}
return false;
}
function jump(){
var index =document.forms(0).jumpPage.value;
document.images[ "tp "].src= ' <%=request.getContextPath()%> /upload/ '+ myImages[index-1];
return false;
}
function sub(){
document.forms(0).method.value= "look ";
document.forms(0).submit();
}
function prints(){
ll_row = dw_print.getrow();
ls_tmp = dw_print.describe( "evaluate( 'page() ', "+string(ll_row)+ ") ");
if len(ls_tmp) > 0 then ls_command = " datawindow.print.page.range = ' "+ls_tmp+ " ' ";
dw_print.modify(ls_command);
dw_print.print();
}
-->
</script>
</head>
<%
String m=request.getAttribute( "count ").toString();
int count =Integer.parseInt(m);
%>
<body background= "images/bg.jpg ">
<object id= "WebBrowser " width=0 height=0 classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 "> </object>
<center>
<html:form action= "/teacher/paper.do?struct=1 " method= "post ">
<table width= "760 " bgcolor= "#c0d3f3 ">
<%
String slave =(String)request.getAttribute( "slave ");
if( slave != null && !slave.equals( " ")){
String[] slaves =slave.split( "; ");
%>
<tr >
<td width= "600 " height= "480 ">
<% if(count==0){%>
<div class= "PageNext " align= "center "> <img name= "tp " src= " <%=request.getRealPath( "/upload ")%> / <%=slaves[0]%> "> </div>
<% }else{
%>
<div class= "PageNext " align= "center "> <img name= "tp " src= " <%=request.getRealPath( "/upload ")%> / <%=slaves[count-1]%> "> </div>
<%}%>
</td>
</tr>
<tr class= "Noprint ">
<td width= "600 " height= "40 " align= "center ">
<input type= "hidden " name= "id " value= " <%=request.getAttribute( "id ")%> ">
<input type= "hidden " name= "method ">
<%
if(slaves.length> 1) {
%>
共 <%= slaves.length%> 张 <a href= "# " onclick= "return previous() "> 上一张 </a> <a href= "# " onclick= " return next() "> 下一张 </a>
转到第
<select name= "jumpPage " onchange= "javascript:jump() ">
<%for(int i=1;i <=slaves.length;i++){
if(i==count){
%>
<option selected value= <%=i%> > <%=i%> </option>
<%}else{
%>
<option value= <%=i%> > <%=i%> </option>
<%
}
}
%>
</select> 张 <br>
<%
}
%>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)> </input>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)> </input>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)> </input>
<input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)> </input>
<input type= "button " value= "全部打印 " onclick= "prints() "> </input>
</td>
</tr>
<%
}
%>
</html:form>
</center>
</body>
</html:html>
我想打印多有分页中的照片该怎么办啊
[解决办法]
噢:)