弹出窗口动态传递参数

DarkNight 广东深圳心雨在线科技开发有限公司 开发总监  2008-04-12 11:11:31
A页面
<body>
<form action="" method="get" name="fomr1">
<%
selshow=request.Form("selshow")
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from things where s_nameid in(select s_nameid from class_s where s_name='"&selshow&"')"
rs.open sqlstr,conn,1,1
%>
<SCRIPT language=javascript>
function setnew(id)
{
window.open ('newwindow.asp?id=+id', '查看商品状态', 'height=310, width=410, top=200, left=300, toolbar=no, scrollbars=no, resizable=no,location=no, status=no')
}
</SCRIPT>
<%
if rs.recordcount<1 then
response.Write"<div align=""center""><font color=""red"">没有该商品,请核对查询条件!!!</font></div>"
response.end()
else
response.Write"<table cellpadding=""0"" cellspacing=""0"" align=""center"" border=""1"" bgcolor=""#DFEFFD"">"&vbcrlf
response.Write "<tr align=""center"" bgcolor=""#A0B8FC"">"&vbcrlf
response.Write "<td >商品名</td><td>商品价格</td><td>会员特价</td><td >商品简图</td><td>商品简介</td><td>商品介绍</td><td>上架时间</td>"&vbcrlf
response.Write "</tr>"&vbcrlf
do while not rs.eof
response.write "<tr align=""center"">"&vbcrlf
response.write "<td><a href=""javascript:setnew('" &rs("id")& "');void(0);"">"&rs("name")&"</a></td><td>"&rs("price")&"元</td><td><font color=""red"">"&rs("vip_price")&"元</font></td><td><img src=""image/"&rs("image")&""" alt=""暂无此图"" name=""image"" width=""32"" height=""32""></td><td>"&rs("jianjie")&"</td><td>"&rs("show")&"</td><td>"&rs("addtime")&"</td>"&vbcrlf
rs.movenext
loop
response.write "</tr>"&vbcrlf
end if
response.write "</table>"
rs.close
set rs=nothing
set conn=nothing
%>

</form>
</body>
----------------------------------------------------------------------------------------------------
B页面
<%
id=trim(request.QueryString("id"))
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from things where id="&id
rs.open sqlstr,conn,1,1
if (rs.eof and rs.bof) then
response.Write"<font color=""red"">此商品已售完!如有带来不便,请谅解</font>"
else
%>
<%names=rs("name")%>
<title><%=names%></title>


<style type="text/css">
<!--
.tables {
border: thin solid #CCCEFD;
font-size: 13px;
color: #000000;
}
body,td,th {
font-size: 13px;
color: #000000;
}
-->
</style>
<body>
<div align="center">
<table width="402" height="305" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="231" rowspan="5" align="center" class="tables"><img name="image1" src="image/<%=rs("image")%>" width="140" height="139" alt="暂无此图"></td>
<td width="84" height="52" align="center">商品名称:</td>
<td width="87" align="left"><%=rs("name")%></td>
</tr>
<tr>
<td height="50" align="center">商品价格:</td>
<td align="left"><%=rs("price")%>元</td>
</tr>
<tr>
<td height="50" align="center">会员特价:</td>
<td align="left" ><font color="#FF0000"><%=rs("vip_price")%>元</font></td>
</tr>
<tr>
<td height="48" align="center">商品介绍:</td>
<td align="left"><%=rs("show")%></td>
</tr>
<tr>
<td height="57" align="center">上架时间:</td>
<td align="left"><%=rs("addtime")%></td>
</tr>
<tr>
<td align="center"><img name="image2" src="images/032444116.gif" width="91" height="22" alt="放入购物车"></td>
<td colspan="2" align="center"><img name="image3" src="images/03244414.gif" width="60" height="21" alt="购买"></td>
</tr>
</table>
</div>
<%
end if
rs.close
set rs=nothing
set conn=nothing
response.Write(id)
%>
</body>
----------------------------------------------------------------------------------------------------
问题:
只显示数据库中的第一条记录,我想应该是B页面的查询语句的问题,输出[color=#00FF00]ID,没有值出来的URL地址为http://localhost/newwindow.asp?id=+id[/color]
...全文
53 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
lsf5921 2008-04-12
'newwindow.asp?id=+id', '查看商品状
'newwindow.asp?id='+id, '查看商品状
回复
yyusnO 2008-04-12

window.open ('newwindow.asp?id='+id, '查看商品状态'

window.open ('newwindow.asp?id=+id', '查看商品状态

不同在于单引号的位置~
回复
DarkNight 2008-04-12
没看出甚么不同
回复
cup_505 2008-04-12
<SCRIPT language=javascript>
function setnew(id)
{
window.open ('newwindow.asp?id='+id, '查看商品状态', 'height=310, width=410, top=200, left=300, toolbar=no, scrollbars=no, resizable=no,location=no, status=no')
}
</SCRIPT>
回复
DarkNight 2008-04-12
自己先做个沙发
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-12 11:11
社区公告
暂无公告