我有一个用VBScript编写的框架。在这个框架中的一些函数中,在If语句中检查函数的参数是否为空,然后执行一些操作。使用Javascript编写的框架的代码。所以我不需要向函数传递任何东西来执行某些操作。在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>在IE <9中,输出将为: Nothing,Null,Nothing。
在IE9: Nothing,Null,Null。
如何在IE9中从Javascript向VBScript传递任何内容?
抱歉,我知道很难看,但我被困住了。并且讨厌VBScript。
edit:有一个框架函数的例子。我不能改变它,因为它在应用程序中被广泛使用。
Function ExampleFunction(val)
If (val Is Nothing) Then
ExampleFunction = 1
Else
ExampleFunction = 0
End If
End Function更新
辞职吧。找到了一个更好的。
https://stackoverflow.com/questions/7568471
复制相似问题