title: Pass Nothing from Javascript to VBScript in IE9
body: <p>I have a framework written in VBScript. Inside some function in this framework, a parameter of the function is checked for <em>Nothing</em> in an <em>If</em> statement and then some actions are executed.</p>
  <p>Code that uses the framework is written in JavaScript. So I need to pass <em>Nothing</em> to the function to perform some actions. In <a href="https://en.wikipedia.org/wiki/Internet_Explorer_8" rel="nofollow noreferrer">Internet Explorer 8</a> and earlier versions, the following approach worked:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;script type=&quot;text/vbscript&quot;&gt;
      Function Test(val)
          If (IsNull(val)) Then
              Test = &quot;Null&quot;
          ElseIf (IsObject(val)) Then
              If (val Is Nothing) Then
                  Test = &quot;Nothing&quot;
              End If
          End If
      End Function
  
      Dim jsNothing
      Set jsNothing = Nothing
      msgBox(Test(jsNothing))
      msgBox(Test(Null))
  &lt;/script&gt;
  
  
  &lt;script type=&quot;text/javascript&quot;&gt;
      alert(Test(jsNothing));
  &lt;/script&gt;
  </code></pre>
  <p>In Internet Explorer before version 9, the output will: Nothing, Null, Nothing.</p>
  <p>In <a href="https://en.wikipedia.org/wiki/Internet_Explorer_9" rel="nofollow noreferrer">Internet Explorer 9</a>: Nothing, Null, Null.</p>
  <p>How can I pass Nothing from JavaScript to VBScript in Internet Explorer 9?</p>
  <p>There is an example of a framework function. I can not change it, because it is widely used in application.</p>
  <pre class="lang-vbnet prettyprint-override"><code>Function ExampleFunction(val)
      If (val Is Nothing) Then
          ExampleFunction = 1
      Else
          ExampleFunction = 0
      End If
  End Function
  </code></pre>