Sub Initialize
On Error Goto errorhandle
Dim session As New notesSession
Dim db As notesdatabase
Dim doccollection As notesdocumentcollection
Dim doc As notesdocument
Dim tmpdoc As notesdocument
Dim item As notesitem
Dim str_query,tmp As String
Dim dbname As String

htmbody=|<body background="/bj.jpg">
<link rel="stylesheet" href="/oa.css">
<style>
h2{display:none}
</style>
<table cellpadding=0 cellspacing=0 width=101.8% background="/Oaimage/titlebj.gif"if"><tr><td width=17%>
<img src="/Oaimage/zuixindt.gif" border="0">
</td></tr></table><HR WIDTH="101.8%" SIZE=2 ALIGN=left COLOR="00603C" NOSHADE CLASS="NosSplit">
<link rel=stylesheet type=text/css href=/css/nosmenu.css>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CCA(CB){
CB.className = 'H';
}
function CCB(CB)
{
CB.className = 'TT';
}
// -->
</SCRIPT>

|
str_query=""
Set doc=session.documentcontext
Set db=session.currentdatabase


dbname=GetDbPath(db)

If (Trim(doc.query(0))<>"") Then
str_query="@contains(field_title;"+"'"+doc.query(0)+"')"+_
"|"+"@contains(field_fbrq;"+"'"+doc.query(0)+"')"
End If

 

'开始查找记录

If str_query="" Then
Print htmbody
Print "<br/><br/><hr  color=green><center><h3>未输入查询条件!"&_
"</h3><center><font size=3 style="宋体"><a href=javascript:onclick=history.back()>返 回</a>" & _
"<hr  color=green>"
Else

Set doccollection=db.search(str_query,Nothing,0)


If doccollection.count=0 Then
Print htmbody
Print "<br/><br/><hr  color=green><center><h3>未找到符合条件的记录"&_
"</h3><center><font size=3 style="宋体"><a href=javascript:onclick=history.back()>返回</a>"&_
"<hr color=green>"
Else
Set tmpdoc=doccollection.getfirstdocument
Print htmbody
Print "<center><h3>共查找到<font color=red>"+Str(doccollection.count)+"</font> 条记录!"_
+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href=javascript:history.back()>返回</a></h3>"
Print "<center><table cellpadding=1 cellspacing=1 class=NosView width=100%><tr class=ViewLineTop><th width=70%>标题</th><th width=30%>发布时间</th></tr>"

For i=1 To doccollection.count
Print "<tr class=ViewLine  onmouseover=CCA(this); onmouseout=CCB(this); class=TT style=cursor:hand>"
temptime=Evaluate("@text(field_fbrq)",tmpdoc)
'If Len(tmpdoc.Subject(0))>33 Then
'Subject=Left(tmpdoc.Subject(0),33)+"..."
'Else
'Subject=tmpdoc.Subject(0)
'End If
Print "<td>"+_
"<a href=/"+dbname+"/notes_view_title/"+tmpdoc.universalid+"?opendocument>"+_
tmpdoc.field_title(0)+"</td>"+_
"<td>"+temptime(0)+"</td></tr>"

Set tmpdoc=doccollection.getnextdocument(tmpdoc)
Next
Print"</table>"
End If
End If
Exit Sub

errorhandle:
Print htmbody
Print "<br/>"+Error()
Print "<br/><h3>发生了错误!</h3><a href='javascript:refresh()'>返回</a>"

End Sub

首先来说用search查找的内容只能通过Print方式解决,但是翻页是可以带参数的.比如说根据你表单上域需要一页显示多少条数,加入&Start=1&Count=10这样的参数加以计算就可以了.