p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: VBScript Function from JScript both running on Server side

Message #1 by "Console G" <consolegod@h...> on Mon, 10 Jun 2002 16:03:27
I am using VBScript and JavaScript on server side for a web-based data 
entry program. There are some VBScript functions I want to use in the 
JavaScript side. But the problem is VBScript and JavaScript both are 
running on the server side. I saw some examples of using VB Functions in 
JScript, but the JScript is on client machine, not on the server machine. 
Some may ask why I am trying to use both Scripting language on the server 
side. I am actually working on some ASP pages where a VB dll has been used 
as an ActiveX object. My project goal is to get rid of that VB dll. So my 
first choice is to translate that VB dll to VBScript. Unfortunately that 
VB dll was used by JScript running at Server side. So I found myself in 
the above-mentioned situation. I will appreciate if somebody have some 
suggestions. Thanks. 

here is the code and the output. It's giving me error when I am trying to 
use VBFunc after calling JSxyz("/JS(6)\n").


Public Function VBFunc(sMethodStatement)
    Dim sMethod
    sMethod = Replace(sMethodStatement,"\#", Chr(34))
    Execute "Response." & sMethod
End Function

VbFunc "Write \#Follow the black sheep.(3) <br>\#"
JSxyz " /VBScript (4)/ "


<Script Language='JavaScript' runat='server'>
function JSxyz(sd)
Response.write("White Rabbit flies away " + sd)
VbFunc("Write \#Follow the white rabbit in JS.\#")
<%VBFunc "Write \#Follow the white rabbit.(8)\#"%>
<%JSxyz "/JS22(9)<br>"%>

White Rabbit flies away /Jscript(5)/White Rabbit flies away /JS(6) 
Microsoft JScript runtime error '800a138f' 

Object expected 

/butler/be/test/re.asp, line 22 Follow the black sheep.(3) 
White Rabbit flies away /VBScript (4)/ White Rabbit flies away /JS22(7)
Follow the white rabbit.(8)White Rabbit flies away /JS22(9)

  Return to Index