Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Calling vbscript using java script.

Posted on 1998-12-01
4
Medium Priority
?
161 Views
Last Modified: 2008-02-26
I can run javascript and vb script on the same page, and everything is functioning like I want it to, but now, I want to call one of my functions in vb by the javascript, and pass it some parameters......Is this possible..?
0
Comment
Question by:ShaunMarion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Accepted Solution

by:
PBall earned 400 total points
ID: 1274861
And why not?

<html>
<head>
<script language='VBScript'>
function VBFunc1(param)
  msgbox("You entered " & param & " when calling this function (VBFunc1)")
  VBFunc1 = JSFunc2(param)
end function

function VBFunc2(param)
  msgbox("You entered " & param & " when calling this function (VBFunc2)")
  msgbox("Too much redirecting and mix languages... I am confused. I better stop now.")
  VBFunc2 = "This is the value returned from VBFunc2"
end function
</script>

<script language='JavaScript'>
function JSFunc1(param)
{
  alert("You entered " + param + " when calling this function (JSFunc1)")
  alert(VBFunc1(param))
}

function JSFunc2(param)
{
  alert("You entered " + param + " when calling this function (JSFunc2)")
  return (VBFunc2(param))
}
</script>
</head>
<body onLoad="JSFunc1('Hello, World!')">
</body>
</html>
0
 
LVL 6

Expert Comment

by:PBall
ID: 1274862
The sample in the answer demonstrate that quite well.

I was passing parameter from JSFunc1 to all other functions
and as the last trick, VBFunc2 will also pass a return value back up the chain to JSFunc1.

It's doable :-p.

0
 
LVL 6

Expert Comment

by:PBall
ID: 1274863
Hehe,

I do this all the time when some functions are just easier to do (or already built) in one or the other scripting language.  A good example for this is VBScript Date object functions (DateAdd, DateDiff, etc. etc.) which are not implemented in JavaScript (write your own if you wish).  I have to use those functions quite often, so why not mismatch the language?  Faster development time.
0
 

Author Comment

by:ShaunMarion
ID: 1274864
thanks.......
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question