mix*_*xel 123 javascript vbscript internet-explorer-9
我有一个用VBScript编写的框架.在这个框架内部的一些函数中,函数的参数在If语句中检查Nothing,然后执行一些动作.使用Javascript编写的框架的代码.所以我需要传递Nothing来执行某些操作.在IE8和早期版本中工作的下一个方法:
<script type="text/vbscript">
Function Test(val)
If (IsNull(val)) Then
Test = "Null"
ElseIf (IsObject(val)) Then
If (val Is Nothing) Then
Test = "Nothing"
End If
End If
End Function
Dim jsNothing
Set jsNothing = Nothing
msgBox(Test(jsNothing))
msgBox(Test(Null))
</script>
<script type="text/javascript">
alert(Test(jsNothing));
</script>
Run Code Online (Sandbox Code Playgroud)
在IE <9中输出将:Nothing,Null,Nothing.
在IE9中:没有,Null,Null.
如何在IE9中将Nothing从Javascript传递给VBScript?
对不起,我知道这很丑,但我被困了.并讨厌VBScript.
编辑: 有一个框架功能的例子.我无法改变它,因为它在应用中被广泛使用.
Function ExampleFunction(val)
If (val Is Nothing) Then
ExampleFunction = 1
Else
ExampleFunction = 0
End If
End Function
Run Code Online (Sandbox Code Playgroud)
更新
退出工作.找到一个更好的.