Is it possible to exchange data between Javascript and VBScript! In other words can they communicate!
| SitePoint Sponsor |


Is it possible to exchange data between Javascript and VBScript! In other words can they communicate!
I don't think so, unless you applied said data to a document element, and then read it with the other language.
Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.
I didn't think so either, but it just so happens that someone has asked me this question before and I experimented a little. I was surprised - but it does work:
Code:<html> <head> <script type='text/javascript'> window.onload = function() { entrance_onClick(); } function js() { alert("js function called from vbs"); } </script> <script language="vbscript"> Sub entrance_onClick MsgBox ("vbs sub called from js") js() End Sub </script> </head> <body> </body> </html>
Of course, it only works in IE![]()
The same goes for server-side JScript and VBScript in ASP.
However, just to pre-empt anyone asking, you cannot call server-side code from client-side code (or vice-versa) without using remote scripting - JSRS being the implementation that I'd recommend.
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code
- Please think, Google, and search these forums before posting!
Bookmarks