图6.11 应用IsNumeric()函数判断输入的商品金额是否为数字型
<%
set conn=server.CreateObject("adodb.connection")
path=server.mappath("db_database.mdb")
conn.open "Provider=Microsoft.jet.oledb.4.0;data source="&path
if request.Form("name1")<>"" then
name1=request.Form("name1")
spje=request.Form("spje")
if IsNumeric(spje) then
spje=request.Form("spje")
else
end if
spsl=request.Form("spsl")
if IsNumeric(spsl) then
spsl=request.Form("spsl")
else
response.Write "<script lanage=javascript>alert('商品数量必须为数字类型');window.location.href='index.asp';</script>"
end if
username=request.Form("username")
sccj=request.Form("sccj")
sun="insert into tb_sp (name1,spje,spsl,username,sccj) values('"&name1&"','"&spje&"','"&spsl&"','"&username&"','"&sccj&"')"
conn.execute(sun)
end if
%>
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交