I. Client to client
1. vbs to JS
<Script language = "VBScript" type = "text/VBScript">
Dim
Jstovbs
Jstovbs = "jstovbs"
Document. writeln (
"I'm vbs :"&
Jstovbs)
</SCRIPT>
<Br/>
<Script language = "JavaScript" type = "text/JavaScript">
Document. writeln (
"I am JS:" + jstovbs );//
The jstovbs variable is defined and assigned values in vbs.
</SCRIPT>
2. js to vbs
<Script language = "JavaScript" type = "text/JavaScript">
VaR jstovbs = "jstovbs"
;
Document. writeln ("I Am a JS:" +
Jstovbs );
</SCRIPT>
<Br/>
<Script language = "VBScript" type = "text/VBScript">
Document. writeln (
"I'm vbs:" & jstovbs) // The jstovbs variable is defined and assigned a value in Js.
</SCRIPT>
II. Server to client
1. vbs to JS
<% @ Language = "VBScript" codePage = "936" %>
<%
DimVbstojs
Vbstojs = "vbstojs"
%>
<Script language = "JavaScript" type = "text/JavaScript">
VaR JS= '<% = Vbstojs %> ';
Document. writeln ("I Am a JS:" +JS );
</SCRIPT>
2. js to vbs
<% @ Language = "JavaScript" codePage = "936" %>
<%
VaR jstovbs = "jstovbs"
%>
<Script language = "VBScript" type = "text/VBScript">
DimVbs
Vbs = "<% = jstovbs %>"
Document. writeln ("I'm vbs :"&Vbs)
</SCRIPT>
3. Client to server
1. vbs to JS
See 2
2. js to vbs
(1) Cookies (submitted and received on the same page, need to be refreshed)
<Script language = "JavaScript" type = "text/JavaScript">
Function
Setcookie (name, value, expires, path, domain, secure)
{
VaR mycookie = Name + "=" +
Encodeuricomponent (value );
If
(Expires)
{
Mycookie + = "; expires =" +
Expires. togmtstring ();
}
If
(PATH)
{
Mycookie + = "; Path =" +
Path;
}
If(Domain)
{
Mycookie + = "; domain =" +Domain;
}
If(Secure)
{
Mycookie + = "; secure";
}
Document. Cookie =Mycookie;
}
Setcookie ('jstovbs ', 'jstovbs cookies', false);
</SCRIPT>
<%
Dim vbs
Vbs= Request. Cookies ("jstovbs")
Response. Write (vbs)
%>
(2) automatic submission (get mode, two pages)
A. js.html (client)
<Script language = "JavaScript" type = "text/JavaScript">
// You can define a function that is automatically submitted as needed.
Location. href = "ASP. asp? Jstoasp = this variable is passed by the client JS"
;
</SCRIPT>
B. asp. asp (server side)
<
%
Dim
Vbs
Vbs = request. querystring ("jstoasp"
)
Response. Write (vbs)
%>