如果我变成回忆mv女主:asp问题,请大哥帮忙 阿

来源:百度文库 编辑:高考问答 时间:2024/04/27 13:47:00
<html>
<head>
<title>无标题文档</title>
</head>

<body>
<form name="text" method="post"
action="">
a<input type="text" name="a">
+
b<input type="text" name="b">
<input type="submit" value="提交">
<%
dim a,b,c
a=request.Form("a")
b=request.Form("b")
c=cint(a)+cint(b)
response.write "最终答案" &cstr(c)
%>
</form>
<form name="text" method="post"
action="">
d<input type="text" name="d">
-
e<input type="text" name="e">
<input type="submit" value="提交">
<%
dim d,e,f
d=request.Form("d")
e=request.Form("e")
f=cint(d)-cint(e)
response.write "最终答案" &cstr(f)
%>
</form><form name="text" method="post"
action="">
g<input type="text" name="g">
*
h<input type="text" name="h">
<input type="submit" value="提交">
<%
dim g,h,i
g=request.Form("g")
h=request.Form("h")
i=cint(g)*cint(h)
response.write "最终答案" &cstr(i)
%>
</form><form name="text" method="post"
action="">
j<input type="text" name="j">
/
k<input type="text" name="k">
<input type="submit" value="提交">
<%
dim j,k,l
j=request.form("j")
k=request.form("k")
l=cint(j)/cint(k)
response.write "最终答案" &cstr(l)
%>
</form>

</body>
</html>

请问一下..为什么会冲突了

问题出在这里
<%
dim j,k,l
j=request.form("j")
k=request.form("k")
l=cint(j)/cint(k)
response.write "最终答案" &cstr(l)
%>
表单没传值过来前k和l都是空,这时ASP会认为这两个值是0,0/0当然出错.
解决办法就是加个判断

<%
if request.form("j")<>"" and request.form("k")<>"" then '表单有传数据过来时才执行
dim j,k,l
j=request.form("j")
k=request.form("k")
l=cint(j)/cint(k)
response.write "最终答案" &cstr(l)
end if
%>

写一个form 就可以了 你没发现form 的名字都写成一样了吗

把错误与贴出来看看啊,只是说冲突怎么知道是哪里哦?如第几行什么的。。。