关于IsNull

Foxtable给所有的DOM元素都扩展了一个IsNull函数,用于判断该元素是否存在。

这是因为这个DOM不是原生的,最终会将所有代码解释成JS脚本执行,所以元素不管是否存在,都不会返回Nothing,必须用IsNull方法判断。

例如:

'''Async
Dim
wv As WebViewer = e.Form.Controls("WebViewer1").WebViewer
Dim
tbl = wv.querySelector("#testTable")
If
Await tbl.IsNull() Then '判断元素是否存在
    MessageBoxA.Show(
"这个table不存在!")
End
If
Dim
oldCaption = tbl.caption
If
Await oldCaption.IsNull() = False Then '判断表标题是否存在
    tbl.deleteCaption()

End
If
Dim
newCaption = Await tbl.createCaption()
newCaption.innerHTML =
"员工信息表 - 创建于 " & DateTime.Now.ToString("HH:mm:ss")


本页地址:http://www.foxtable.com/webhelp/topics/6379.htm