关于 isnumeric() 函数

if not isnumeric(name) or not isnumeric(pwd) thenresponse.write "用户名和密码不能为空"

上面是什么意思 ?

isnumeric 函数应该返回tuue或flase.
可是这个为什么没有,那它怎么判断的呢?
这样写行不行:
if not isnumeric(name) or not isnumeric(pwd)=""then
response.write "用户名和密码不能为空"
我的意思是:if not isnumeric(name) or not isnumeric(pwd) then... 为什么if not isnumeric(name) or not isnumeric(pwd) 后面没有条件 就直接 then 了 没条件怎么能then 呢? if not isnumeric(name) or not isnumeric(pwd) then response.write "用户名和密码不能为空" 这里很明显意思是:if not isnumeric(name) or not isnumeric(pwd) 假如是空就response"" 这不就是能判断为空吗?

第1个回答  2008-06-25
IsNumeric 函数 返回 Boolean 值,指出表达式的运算结果是否为数。语法IsNumeric(expression)必要的 expression 参数是一个 Variant,包含数值表达式或字符串表达式。说明如果整个 expression 的运算结果为数字,则 IsNumeric 返回 True;否则返回 False。如果 expression 是日期表达式,则 IsNumeric 返回 False。

if not isnumeric(name) or not isnumeric(pwd)=""then
response.write "用户名和密码不能为空"

没有语法错误, isnumeric(pwd)="" 不管怎么样 他肯定是假

not 那么就是真 然后 你用 or 连接的,就是说,无论怎么样 都会输出 用户名和密码不能为空本回答被提问者采纳
第2个回答  2008-06-25
首先isnumeric()函数不是检查是不是为空的,而是检查是否为数字格式.

isnumeric(name)意思是name是数字的时候返回TRUE,其他返回FALSE,加NOT语句是判断ISNUMERIC(NAME)不为真(非数字)时执行的语句.

aa="abcdefg"
if not isnumeric(aa) then
Response.Write "不是数字格式"
else
Response.Write "是数字格式"
end if

'判断是否为空
name=Request("name")
pwd=Request("pwd")
if name="" or pwd="" then
Response.Write "不能为空"
end if
相似回答