在vbscript中检查null

时间:2015-04-30 15:14:55

标签: vbscript

我有以下代码无法正常工作。有人可以看一下,告诉我这里会发生什么。当我在警报中读取对象值时,它显示为null但是当我通过IsNull测试对象的值时,对象不会表现为null。

' This object comes out null in alert
         alert(ROSnode.selectsinglenode("./root/allnegative"))

           ' The same object comes out as not null in this if
           if not IsNull(ROSnode.selectsinglenode("./root/allnegative")) then
            alert("Not showing null here")
            templateDSO.selectsinglenode("//rosv2").appendchild   ROSnode.selectsinglenode("./root/allnegative")
          else
          alert("It is null")
          end if

由于

1 个答案:

答案 0 :(得分:0)

isnull仅在变量存储为Null时有效,您可以检查该值是否等于空白,如同ROSnode.selectsinglenode(" ./ root / allnegative")<> ""然后或者如果ROSnode.selectsinglenode(" ./ root / allnegative")什么都不是那么