在线等,WEB新手高分求助

dean88 2009-12-07 09:51:15
1.asp 里面有2个按钮
<input name="click1" id="click1" type="button" onClick="window.open('check.asp?price=1&ProdId=<%
if rs2("stock")>0 then
response.write rs2("id")&"','','scrollbars=yes,width=760,height=500')"
else response.write "alert('对不起,库存不足,请过段时间再来购买该商品!');window.close();"
end if %> " class="greenbuttoncss" value="放入购物车" />

<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?price=2&ProdId=<%
if rs2("stock")>0 then
response.write rs2("id")&"','','scrollbars=yes,width=760,height=500')"
else response.write "alert('对不起,库存不足,请过段时间再来购买该商品!');window.close();"
end if %> " class="greenbuttoncss" value="放入购物车" />





2.asp里面,我设定了一组语句判断
<% if name=click1 then
response.Write(price)
elseif name=ss2 then
response.write(price2)
end if
%>

PRICE 代表按钮1的那个价格 price2代表按钮2的价格

现在测试了下,无论按那个按钮,也只能获取PRICE的价格

请问如何修改?我才能分别获取两个价格
...全文
155 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
dean88 2009-12-08
  • 打赏
  • 举报
回复
LSD,真的很谢谢你,问题解决了。。。谢谢
wlcsdf 2009-12-07
  • 打赏
  • 举报
回复
1.asp

<%if rs2("stock")>0 then %>
<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?price2=2&ProdId= <%=rs2("id")%>/>
<%else%>
<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?price2=2&ProdId= <%="没有该商品!"%>/>
<% end if %>

在check.asp中做判断,
<%if ProdId="没有该商品!" then
alert "没有该商品"
end if%>
2.asp

<% if name=click1 then
response.Write(price)
else
response.write(price2)
end if
%>

dean8828 2009-12-07
  • 打赏
  • 举报
回复
没人帮忙解决吧
dean88 2009-12-07
  • 打赏
  • 举报
回复

<%
dim id,company,intro,graph2,description,remarks,price,price2,rs2,strSorts,strCategory
id=Int(saferequest("id",1))


set rs2=server.CreateObject("adodb.recordset")
sql="select * from product order by ID desc"
rs2.open sql,conn,1,1
if rs2.eof and rs2.bof then
response.Write "暂无产品上架"
response.End
end if
rs2("viewnum")=rs2("viewnum")+1
rs2.update
IntCatID = rs2("categoryid")
IntCatIDLong=IntCatID

set rs=server.CreateObject("adodb.recordset")
if IntCatID = 0 then
rs.open "Select categoryid,category,ParentID From category Where categoryid="&IntCatID,conn,1,1
if rs.eof and rs.bof then
response.Write "<script LANGUAGE='javascript'>alert('您输入的参数非法,请正确操作!');history.go(-1);</script>"
rs.close
set rs = Nothing
conn.Close
set conn=nothing
response.end
end if

strCategory = "<a href=b2b_cplist.asp?catid="&rs("categoryid")&">"&rs("category")&"</a>->"&strCategory
TitleCategory = TitleCategory&""&rs("category")&"->"
IntCatID = rs("ParentID")
IntCatIDLong=CStr(IntCatIDLong)&","&CStr(rs("ParentID"))
end if
set rs = nothing
%>




dean88 2009-12-07
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 wlcsdf 的回复:]
<input name="ss2"  id="ss2" type="button" onClick="window.open('check.asp?price=2&ProdId= <%
  if rs2("stock")>0 then
你这里的代码写错了,应该是PRICE2=2。别说了,给分!!!
[/Quote]

不行,问题不是出在这里
dean88 2009-12-07
  • 打赏
  • 举报
回复
测试了下,不行,如果用了这段代码后会出现
If Request("cmdShow") = "Yes" Then
ProductList = ""
Products = Split(Request("ProdId"), ", ")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
End If
If Len(Session("ProductList")) = 0 Then
Response.write "<table height=100% width=100% ><tr><td align=center>您的购物车为空,<a href=index.asp><b>继续购物</b></a> <a href=""JavaScript:onClick=window.close();""><B>关闭窗口</B></a></td></tr></table>"
Response.end
end if
%>

获取不了值的
wlcsdf 2009-12-07
  • 打赏
  • 举报
回复
<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?price=2&ProdId= <%
if rs2("stock")>0 then
你这里的代码写错了,应该是PRICE2=2。别说了,给分!!!
anbs01 2009-12-07
  • 打赏
  • 举报
回复
<%
if rs2("stock")>0 then
id = rs2("id")
else response.write "alert('对不起,库存不足,请过段时间再来购买该商品!');window.close();"
end if %>
<input name="click1" id="click1" type="button" onClick="window.open('check.asp?price=1&ProdId=','','scrollbars=yes,width=760,height=500') " class="greenbuttoncss" value="放入购物车" />
shenzhenNBA 2009-12-07
  • 打赏
  • 举报
回复
msg='对不起,库存不足,请过段时间再来购买该商品!'

这个多余了
shenzhenNBA 2009-12-07
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 dean88 的回复:]
不行。。。2.asp(check.asp)获取不了值,2个都是
[/Quote]

<%
dim ProdId,msg
if rs2("stock")>0 then
ProdId=rs2("id")
else
msg='对不起,库存不足,请过段时间再来购买该商品!'
response.write "<script>"
response.write "alert('对不起,库存不足,请过段时间再来购买该商品!');window.close();"
response.write "</script>"
response.end()
end if
%>


上面不变,下面修改...

<input name="click1" id="click1" type="button" onClick="window.open('check.asp?name=click1&price=1&ProdId=<%=ProdId%>','','scrollbars=yes,width=760,height=500')" class="greenbuttoncss" value="放入购物车" />
<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?name=ss2&price=2&ProdId=<%=ProdId%>','','scrollbars=yes,width=760,height=500')" class="greenbuttoncss" value="放入购物车" />

2.asp里面
不变



dean88 2009-12-07
  • 打赏
  • 举报
回复
不行。。。2.asp(check.asp)获取不了值,2个都是
ZSJ_COOL 2009-12-07
  • 打赏
  • 举报
回复
楼上对了
shenzhenNBA 2009-12-07
  • 打赏
  • 举报
回复
修改如下,试看。。。。


<%
dim ProdId,msg
if rs2("stock")>0 then
ProdId=rs2("id")
else
msg='对不起,库存不足,请过段时间再来购买该商品!'
response.write "<script>"
response.write "alert('对不起,库存不足,请过段时间再来购买该商品!');window.close();"
response.write "</script>"
response.end()
end if
%>

<input name="click1" id="click1" type="button" onClick="window.open('check.asp?price=1&ProdId=<%=ProdId%>','','scrollbars=yes,width=760,height=500')" class="greenbuttoncss" value="放入购物车" />

<input name="ss2" id="ss2" type="button" onClick="window.open('check.asp?price=2&ProdId=<%=ProdId%>','','scrollbars=yes,width=760,height=500')" class="greenbuttoncss" value="放入购物车" />


2.asp里面

<%
dim name
name=request.querystring("name")
if name="click1" then
response.Write(price)
elseif name="ss2" then
response.write(price2)
end if
%>

黑心 2009-12-07
  • 打赏
  • 举报
回复
O 顶一下
dean88 2009-12-07
  • 打赏
  • 举报
回复

<% if name=ss2 then
response.write(price2)
elseif name=click1 then
response.Write(price)
end if
%>  元


我发觉换成这段代码,竟然读到price2的价格,无论按那个按钮,汗!!!!!!


这问题到底出在哪里勒呢,解决+分,谢谢各位
dean88 2009-12-07
  • 打赏
  • 举报
回复
这样也不行,而且写法好像有点错误

28,406

社区成员

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

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