ASP语句写在function中的问题

yuanfen127 2003-09-16 02:11:10
<html>
<head>
<script language=javascript>
function next()
{
......实现文本框中的值是下一条记录的值
}
</script>
</head>
<body>
<form name=main>
<input type=text name=user value="<%=asima.fields('username').value%>">
<input type=button value="下一条记录" onclick='next()'>
</form>
</body>
</html>

其中asima.fields('username').value是指向数据库中字段名为username的内容,现在我想要点"下一条记录"来使asima.movenext,下一条记录,那么在next()中我想要加入

<%asima.movenext%>
main.user.value="<%=asima.fields('username').value%>"

但是这两句语句有ASP语句,镶嵌在function中好象不行,请大家帮忙解决一下啊!
...全文
79 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuanfen127 2003-09-29
  • 打赏
  • 举报
回复
id=request( "id ")
if id= " " then id = 0
这段不行,不能实现,
结贴
yuanfen127 2003-09-29
  • 打赏
  • 举报
回复
id=request( "id ")
if id= " " then id = 0
这段不行,不能实现
Fengq 2003-09-16
  • 打赏
  • 举报
回复
利用传值来实现,假如该页为show.asp
<%
id=request("id")
if id= "" then id = 0
...
...
'自己加条语句控制下,别让超出最大记录数
for i = 0 to id
asima.movenext
next

%>

<form name=main>
<input type=text name=user value="<%=asima.fields('username').value%>">
<input type=button value="下一条记录" onclick="top.location.href='show.asp?id=<%=id+1%>'">
</form>
ttt2 2003-09-16
  • 打赏
  • 举报
回复
把rs.pagesize设为1

在使用分页程序不就行了吗
<%
response.buffer=false
%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>工程查询</title>
</head>
<style>
table{font-size:9pt}
body{font-size:9pt}
</style>
<script language="javascript">
function check()
{
//if(document.form1.gjz.value=="")
//{
//alert("请输入关键字")
//return false
//}

document.form1.submit()

}
</script>
<body>
<%
function bh(t)
select case t
case "注册号"
bl="a.注册号"
case "工程名称"
bl="a.工程名称"
case "建设单位名称"
bl="a.A名称"
case "设计单位"
bl="b.c名称"
case "施工单位"
bl="c.b名称"
end select
bh=bl
end function


p=request.querystring("p")
if p="" then p=1

gjz=request.querystring("gjz")

gjz1=request.querystring("gjz1")

gjz2=request.querystring("gjz2")

gjz3=request.querystring("gjz3")

gjz4=request.querystring("gjz4")

type1=request.querystring("type1")
if type1="" then type1="注册号"

type2=request.querystring("type2")
if type2="" then type2=1

%>
<p>工程监督查询</p>
<form method="get" action="gcjd.asp" name="form1">
<p>
简单查询<input type="radio" value="1" checked name="type2" <% if type2=1 then%>checked<%end if%>>
关键字
<input type="text" name="gjz" size="18" value="<%=gjz%>"> <select size="1" name="type1">
<option value="注册号" <% if type1="注册号" then%>selected<%end if%>>注册号</option>
<option value="工程名称" <% if type1="工程名称" then%>selected<%end if%>>工程名称</option>
<option value="建设单位名称" <% if type1="建设单位名称" then%>selected<%end if%>>建设单位名称</option>
<option value="设计单位" <% if type1="设计单位" then%>selected<%end if%>>设计单位</option>
<option value="施工单位" <% if type1="施工单位" then%>selected<%end if%>>施工单位</option>
</select>  </p>
<p>
组合查询<input type="radio" name="type2" value="2" <% if type2=2 then%>checked<%end if%>></p>
<p>
工程名称    
<input type="text" name="gjz1" size="18" value="<%=gjz1%>"></p>
<p>
建设单位名称
<input type="text" name="gjz2" size="18" value="<%=gjz2%>"></p>
<p>
设计单位    
<input type="text" name="gjz3" size="18" value="<%=gjz3%>"></p>
<p>
施工单位    
<input type="text" name="gjz4" size="18" value="<%=gjz4%>"></p>
<p>
<input type="button" value="查询" name="B2" onclick="check()"></p>
</form>
<%

set cn=server.createobject("adodb.connection")
cn.open "driver={microsoft access driver (*.mdb)};password=S56458;dbq="&server.mappath("JDSJ.mdb")



if type2=1 then

if gjz="" then
con=" "
else
con="and "&bh(type1)&" like '%" & gjz &"%'"
end if

else
con="and a.工程名称 like '%"&gjz1&"%' and a.A名称 like '%"& gjz2 &"%' and b.c名称 like '%"& gjz3 &"%' and c.b名称 like '%"& gjz4 &"%' "

end if

'con="and a.工程名称 like '%"&gjz1&"'% and a.A名称 like '%"& gjz2 &"%' and b.c名称 like '%"& gjz3 &"%' and c.b名称 like '%"& gjz4 &"%' "
'response.write con
set rs=server.createobject("adodb.recordset")
rs.pagesize=20

rs.open "select a.注册号,a.工程名称,a.A名称,a.B编号,a.c编号,b.c名称,c.b名称 from 注册表 a,设计单位 b,施工单位 c where a.c编号=b.c编号 and a.b编号=c.b编号 "& con & " order by a.注册号 asc",cn,1,3

set rst=server.createobject("adodb.recordset")

%>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="41">
<tr>
<td width="9%" height="20" bgcolor="#C0C0C0"><font color="#000080">注册号</font></td>
<td width="17%" height="20" bgcolor="#C0C0C0"><font color="#000080">工程名称</font></td>
<td width="16%" height="20" bgcolor="#C0C0C0"><font color="#000080">建设单位名称</font></td>
<td width="16%" height="20" bgcolor="#C0C0C0"><font color="#000080">设计单位</font></td>
<td width="16%" height="20" bgcolor="#C0C0C0"><font color="#000080">施工单位</font></td>
<td width="13%" height="20" bgcolor="#C0C0C0"><font color="#000080">验收/核定日期</font></td>
</tr>
<%
if not rs.eof then
i=0
rs.absolutepage=cint(p)
end if
while not rs.eof and i<rs.pagesize

rst.open "select 核定日期 from 核定表6 where 注册号='"&rs("注册号")&"'",cn,1,1
if not rst.eof then
hd=rst("核定日期")
end if
%>
<tr>
<td width="9%" height="21"><%=rs("注册号")%></td>
<td width="17%" height="21"><%=rs("工程名称")%></td>
<td width="16%" height="21"><%=rs("A名称")%></td>
<td width="16%" height="21"><%=rs("c名称")%></td>
<td width="16%" height="21"><%=rS("B名称")%></td>
<td width="13%" height="21"><%=hd%></td>
</tr>
<%
rst.close
i=i+1
rs.movenext
wend
%>
</table>

<Br>  共有<%=rs.recordcount%>条记录    每页显示<%=rs.pagesize%>条     <% if rs.pagecount=0 then%>0<%else%><%=p%><%end if%> / <%=rs.pagecount%>   <%
if rs.recordcount=0 then
else
%><input type="button" value="首页" onclick="location.href='gcjd.asp?gjz=<%=gjz%>&type1=<%=type1%>&bmname=<%=bmname%>&type2=<%=type2%>&gjz1=<%=gjz1%>&gjz2=<%=gjz2%>&gjz3=<%=gjz3%>&gjz4=<%=gjz4%>'" class=in02>
<%if cint(p)>1 then%>
<input type="button" value="上页" onclick="location.href='gcjd.asp?p=<%=p-1%>&gjz=<%=gjz%>&type1=<%=type1%>&bmname=<%=bmname%>&type2=<%=type2%>&gjz1=<%=gjz1%>&gjz2=<%=gjz2%>&gjz3=<%=gjz3%>&gjz4=<%=gjz4%>'" class=in02>

<%end if%>
<% if cint(p)-rs.pagecount=0 then%>
<%else%>
<input type="button" value="下页" onclick="location.href='gcjd.asp?p=<%=p+1%>&gjz=<%=gjz%>&type1=<%=type1%>&bmname=<%=bmname%>&type2=<%=type2%>&gjz1=<%=gjz1%>&gjz2=<%=gjz2%>&gjz3=<%=gjz3%>&gjz4=<%=gjz4%>'" class=in02>
<%end if%>
<input type="button" value="尾页" onclick="location.href='gcjd.asp?p=<%=rs.pagecount%>&gjz=<%=gjz%>&type1=<%=type1%>&bmname=<%=bmname%>&type2=<%=type2%>&gjz1=<%=gjz1%>&gjz2=<%=gjz2%>&gjz3=<%=gjz3%>&gjz4=<%=gjz4%>'" class=in02>
<%end if%>
<input type="hidden" value="<%=p%>" name="p">
</body>

</html>
yuanfen127 2003-09-16
  • 打赏
  • 举报
回复
急用,请大家帮忙!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧