证书格式的网页 求格式控制方法
现要做一个证书格式的网页 代码如下程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <%dbdns=""%> <!--#include file="inc/chk.asp"--> <!--#include file="inc/function.asp"--> <%id=CmdSafeLikeSqlStr(request("id")) if id="" then id=session("userName") rs.open "select showtime from config",conn,1,1 if id<>session("userName") And rs(0)=false then id=session("userName") rs.close%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.> <html xmlns="http://www. xml:lang="zh-cn"> <div class="main"><input type="button" value="证书pdf打开" align="right" onClick="javascript:window.open('show.asp')"/> <head> <title>证书</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="robots" content="all" /> <link rel="stylesheet" rev="stylesheet" type="text/css" media="print" href="print.css" /> <link rel="stylesheet" rev="stylesheet" type="text/css" media="screen" href="print.css" /> </head> <!-- ASP读取用户数据 --> <% sql = "select [user].*,depart.name as depart,major.name as major from [user],depart,major where depart.id=[user].depart and major.id=[user].major and [user].userName='"&id&"'" Rs.Open sql,Conn,1,1 Id = Rs("Id") userName = Rs("userName") name = Rs("name") birth = Rs("birth") party = Rs("party") sex = Rs("sex") add = Rs("add") de = Rs("de") depart = Rs("depart") major = Rs("major") Rs.Close itemcount = 0 %> <% sub pageend() Response.Write"<div class='serial'><b>证书 <br /> "&year(now())&"年"&month(now())&"月 </b></div>" end sub sub newpage() Response.Write("</div><div class='rbar'><img src='rbar.png' width='45px'></img></div></div><div class='footer'><img src='print-footer.png' width='950px'></img></div></div>") Response.Write("<div class='next'></div><div id='maincontent'><div class='header'><img src='print-header.png' width='950px'></img></div><div class='content'><div class='lbar'><img src='lbar.png' width='45px'></img></div><div class='pager'>") end sub %> <body background="blank.png" style="width:100%"> <div id="maincontent"> <div class="header"> <img src="print-header.png" width="950px"></img> </div> <div class="content"> <div class="lbar"> <img src="lbar.png" width="45px"></img> </div> <div class="pager"> <div class="serial"> <b>证书编号 No.<%=username%></b><br/><br/> </div> <b><table width="750" border="0"> <tr> <td width="187">姓名: <%=name%></td> <td width="188">性别: <%=sex%></td> <td width="187">学历: 本科</td> <td width="188">政治面貌: <%=party%></td> </tr> <tr> <td colspan="4" height="10"></td> </tr> <tr> <td width="438" colspan="2">学院: <%=depart%></td> <td width="438" colspan="2">专业: <%=de%></td> </tr> </table></b> <hr/> <% sql = "select * from [type]" Rs.Open sql,Conn,1,1 Do While Not Rs.Eof Set opRs = Server.CreateObject("Adodb.RecordSet") Sql = "select * from [detail] where user="&session("Userid")&"and type="&rs("id")&"and show = true and pass1=true and pass2=true and pass3=true order by content" opRs.Open Sql,Conn,0,1 If Not opRs.eof Then If itemcount >31 Then call pageend() call newpage() itemcount=0 End If Response.Write("<h2>"&rs("type")&"</h2>") '打印项目标题 itemcount = itemcount +6 End If Do While Not opRs.Eof If itemcount >31 Then call pageend() call newpage() itemcount=0 End If Response.Write("<ul><li>"&opRs("content")&"</li></ul>") itemcount = itemcount+1 opRs.MoveNext Loop'项目结束 opRs.Close Rs.MoveNext Loop'输出结束 if itemcount <>0 then call pageend() end if Rs.Close %> </div> <div class="rbar"> <img src="rbar.png" width="45px"></img> </div> </div> <div class="footer"> <img src="print-footer.png" width="950px"></img> </div> </div> </body> </html>
现在问题有两点:
1.如果从数据库中取得的某条信息字数过多在显示footer图片会有空白现象
2.如果条目过少,又会提前调用newpage函数
所以是否可以提供更好的方法,获得行数信息,可以控制格式什么的