Calling Jscript objects from VBscript 
Author Message
 Calling Jscript objects from VBscript

I'm writing a VB 5.0 program to automate access to a website using the
Webrowser control.  The website is ASP based and includes various Javascript
functions which I would like to call from my VB program.

My question is: Can I do this in VB, and what syntax do I use to declare and
use these external ASP Javascript functions in my VB program?  Any resources
or examples would be appreciated.

Thanks - Brian



Tue, 28 Jun 2005 02:14:59 GMT  
 Calling Jscript objects from VBscript

Quote:

> I'm writing a VB 5.0 program to automate access to a website using the
> Webrowser control.  The website is ASP based and includes various
> Javascript functions which I would like to call from my VB program.

> My question is: Can I do this in VB, and what syntax do I use to
> declare and use these external ASP Javascript functions in my VB
> program?  Any resources or examples would be appreciated.

Asumming you want access to the *client* side JavaScript fucntions...

Dim HTMLDocument As MSHTML.HTMLDocument
Dim HTMLWindow As MSHTML.HTMLWindow2
'--> or you can late bind using As Object or As Variant

Set HTMLDocument = WebBrowser1.Document
Set HTMLWindow = HTMLDocument.ParentWindow

Window.someJSFunction "foo", "bar"
retValue = Window.anotherJSFunction("alpha", "beta")

Given an object reference into the DHTML DOM, just use the DHTML
documentation to determine what you can do.

--
Michael Harris
Microsoft.MVP.Scripting



Tue, 28 Jun 2005 04:15:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling Jscript Function from Vbscript?

2. Can I call vbscript Sub from Jscript?

3. Calling a JSCRIPT From a VBScript Function

4. Calling VB function from jscript/vbscript?

5. Calling VbScript/JScript from VB

6. VBScript calling to a COM object that expects a user-defined object

7. Objects in VBSCRIPT like Jscript

8. Create printer object in Jscript or VBScript on IE client side scrpting

9. Call DataSpace Object form jscript?

10. JScript call COM object with VARIANT variable reference

11. How JScript call COM object

12. calling ASP from within VBScript/JScript ???????

 

 
Powered by phpBB® Forum Software