日期:2011-01-14  浏览次数:21043 次

Buy.asp
<HTML>

<HEAD>

<title>购货蓝</title>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

</HEAD>

<BODY bgColor=lightcyan>

<P align=center><IMG alt="网上书店"

src="http://edu.cnzz.cn/NewsInfo/file://C:/InetPub/wwwroot/images/title.jpg"><br>

<BODY bgColor=lightcyan>

<form action=buy.asp method=post>

<script language=vbscript>

function ID(mystr)

pos=0

for i=1 to len(mystr)

if mid(mystr,i,1)="`" then

if pos=0 then

ID=left(mystr,i-1)

exit for

end if

end if

next

end function

 

</script>

<%

function ID(mystr)

pos=0

for i=1 to len(mystr)

if mid(mystr,i,1)="`" then

if pos=0 then

ID=left(mystr,i-1)

exit for

end if

end if

next

end function

function BookName(mystr)

pos=0

for i=1 to len(mystr)

if mid(mystr,i,1)="`" then

if pos=0 then

pos=pos+1

else

BookName=mid(mystr,len(id(name))+2,i-2-len(id(name)))

exit for

end if

end if

next

end function

function Price(mystr)

for i= len(mystr) to 1 step -1

if mid(mystr,i,1)="`" then

if pos=0 then

Price=right(mystr,len(mystr)-i)

exit for

end if

end if

next

end function

select case request.querystring("Name")

case "view"

response.write "浏览"

if session("num")="" then

response.write "目前购货蓝中没有选中的书目!"

else

num=clng(session("num"))

response.write "<table border=1><tr><td>书号</td><td>书名</td><td>单价
</td><td>数量</td><td>小计</td></tr>"

session("sum")=0

for i=0 to num

session("sum")=session("sum")+session("sum_" & cstr(i))

response.write "<tr><td>" & session("ID_" & cstr(i)) & "</td><td>" &
session("BookName_" & cstr(i)) & "</td><td>" & session("price_" & cstr
(i)) & "</td><td><input type=text size=5 name=txtNum" & cstr(i) & "
value=" & session("num_" & cstr(i)) & "><td>" & session("sum_" & cstr
(i)) & "</td></td></tr>"

next

response.write "</table>"

Response.Write "购货总金额:" & session("sum")

end if

case ""

response.write "本页内修改"

num=clng(session("num"))

for i=0 to num

session("num_" & cstr(i))=(request.form("txtNum" & cstr(i)))

session("sum_" & cstr(i))=session("num_" & cstr(i))*session("price_"
& cstr(i))

next

response.write "<table border=1><tr><td>书号</td><td>书名</td><td>单价
</td><td>数量</td><td>小计</td></tr>"

session("sum")=0

for i=0 to num

session("sum")=session("sum")+session("sum_" & cstr(i))

response.write "<tr><td>" & session("ID_" & cstr(i)) & "</td><td>" &
session("BookName_" & cstr(i)) & "</td><td>" & session("price_" & cstr
(i)) & "</td><td><input type=text size=5 name=txtNum" & cstr(i) & "
value=" & session("num_" & cstr(i)) & "><td>" & session("sum_" & cstr
(i)) & "</td></td></tr>"

next

response.write "</table>"

Response.Write "购货总金额:" & session("sum")

case else

response.write "增加"

if session("num")="" then

session("num")=0

else

session("num")=clng(session("num")