I am authoring a number of HTML files that will be rendered by an IE control embedded in a third-party application.
In order to provide some fairly complex UI elements with the least amount of fuss, I elected to do most of my coding in JavaScript with jQuery. This generally works well, however the host application provides a large library of support functions I will need to call in order to trigger certain actions (such as printing and database updates). These support functions are all in external VBScript (.vbs) files that I can include in the HTML files' header.
Calling the VBscript functions and accessing global variables from within my JavaScript functions works flawlessly when done directly, but I can't figure out how to pass a reference to a function that was defined in VBScript to a jQuery event handler.
For example, the following code:
1: <script type="text/vbscript">
2: Function handleClick
3: MsgBox "Clicked."
4: End Function
5: </script>
6:
7: <script type="text/javascript">
8: $(function () {
9: $("#clickableThing1").click(handleClick);
10: });
11: </script>
...generates the following error on line 9:
"Object doesn't support this property or method"
Replacing line 9 with the following, however, works as desired:
$("#clickableThing1").click(function() {
handleClick();
});
I've tried passing handleClick to click() as both document.handleClick and as this.handleClick to no avail.
While I can certainly continue to wrap the VBScript calls in anonymous JavaScript functions, that seems unnecessarily verbose as, surely those functions must be defined in the DOM somewhere, right?
Can anyone tell me how I can refer to those VBScript functions directly?