绝品医仙键盘网:这个代码有什么错误?老劳大家!

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 19:04:14
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body><% response.write(request("a"))

w=cint(left(request("a"),1))

q=cint(left(request("a"),2))
response.write(w+q)
%>
<form action="" method="post" name="ab" target="_top">
<input name="a" type="text">
<input name="b" type="submit"></form></body>
</html>

因为cint() 不能为空,所以报错!
你的这段ASP代码要有条件再执行。
比如 表单的 action="?action=ok"
那么 就需要把上面改成
If request("action")="ok" then
if request("a")="" then
response.write "好像没填某些数据把 =。="
else
if IsNumeric(request("a")) then
response.write(request("a"))
w=cint(left(request("a"),1))
q=cint(left(request("a"),2))
response.write(w+q)
else
response.write "请填写数字好不好 =。="
end if
end if
End If

你的form没有定义, <form action="本网页名" method="post" name="ab" target="_top">

把这个网页的名填在上面那个地方

w,q 好像都没有定义变量类型阿~~

你想这样实现这个代码的功能是不好实现的,用JAVASCRIPT比软窬易