Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variable from VBScript to JScript/JavaScript 1

Status
Not open for further replies.

letkemap

Programmer
Jul 24, 2000
4
CA
I understand that VBScript is executed first and then JavaScript/JScript. So how can I pass a JavaScript/JScript function a VBScript variable?<br><br>Can someone help me out?<br>Pete<br><br>Sorry for the cross post, same quesion is posted in the VBScript forum.
 
is it client side or server side?<br>do you mean passing a javascript variable to a vbscript function? <p>ray<br><a href=mailto:rheindl@bju.edu>rheindl@bju.edu</a><br><a href= > </a><br>
 
I will be using VBScript to do some server side scripting and I would like to send the value of the VBScript to JavaScript to do some client side scripting with that value.<br><br>Sorry for the misunderstanding,<br>Pete
 
just say your vbscript variable is called iNumber. create a javascript variable and give it the value of iNumber. in your vbscript code, do:<br><br>Response.write &quot;&lt;script&gt;var iNum = &quot; & iNumber & &quot;;&lt;/script&gt;&quot;<br><br>then, in your javascript, you can access with iNum <p>ray<br><a href=mailto:rheindl@bju.edu>rheindl@bju.edu</a><br><a href= > </a><br>
 

How about the reverse of this problem? Is it possible to get a variable's value that is defined in Javascript over to VBScript?

I have tried what was mentioned above with great success (Thanks!).

Say I have a variable defined like the following:

<script> var iNum=255 </script>

Now, I have some VBScript in which I need the value defined in the previous statement. How do I reference it and can I reference it at all?

Is there any way in the Javascript to copy the value over to a VBScript variable or something like that?

Thanks for your help!

- Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top