View Full Version : VBScript&JScript

01-16-2004, 03:57 PM
I have viewed some examples, they use more than one scripts, that is use <script language="Javascript" type="text/javascript">
... ... </script> block more than once. Why use that? And the global variables are valid in the whole page or only inside one block?
Another question is: can I use both VBscript and JScript in one page. How can the variables be transfered between the two ones.

Thank you!

01-16-2004, 07:26 PM
Global variables are available on the whole page regardless if it's vbs or js, as far as I know.

To communicate from VBScript to JavaScript you can use the "call" in VBS:

<title> </title>

var global = "created in js\n";

<script type="text/VBScript">

Sub vb_function(args)
call javascript_function(args+"passed to vb")
end sub

<script type="text/JavaScript">

function javascript_function(args) {
alert(args + "\npresented in js\n\nglobal: "+global);

<body onload="vb_function(global)">


Remember that the first script tag becomes the default language of the page.