Mixing Script Languages 
Author Message
 Mixing Script Languages

Hi Everyone,

I have an ASP page written primarily in VB Script, but have a process in
this page that is written in JScript.  How can I announce to the server this
part is JScript - And then back to VB Script?

I've tried adding
<% Script Language ="JScript" %> - Doesn't work -
even tried making it an #Include File which also doesn't work
cause you can only have 1 language header.

Any Help would be greatly appreciated.

Matt W.



Mon, 30 Dec 2002 03:00:00 GMT  
 Mixing Script Languages
Put the jscript code in a function defined something like:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  Response.Write("foobar");
  // etc...

Quote:
}

</script>

Then call the jscript function where you need it.

<%
  ... some VBScript code
  call myJSfunction() 'or just myJSfunction
  ... more vbscript code
%>

--
Michael Harris
MVP Scripting

Hi Everyone,

I have an ASP page written primarily in VB Script, but have a process in
this page that is written in JScript.  How can I announce to the server this
part is JScript - And then back to VB Script?

I've tried adding
<% Script Language ="JScript" %> - Doesn't work -
even tried making it an #Include File which also doesn't work
cause you can only have 1 language header.

Any Help would be greatly appreciated.

Matt W.



Mon, 30 Dec 2002 03:00:00 GMT  
 Mixing Script Languages
Thanks Michael, I'm assuming I can create the function right on the same
page or do I need to put it in the global.asa?

Also - The JScript creates a recordset can I call that recordset in VB
Script like normal?

Thanks Again!

Matt W.


Quote:
> Put the jscript code in a function defined something like:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   Response.Write("foobar");
>   // etc...
> }
> </script>

> Then call the jscript function where you need it.

> <%
>   ... some vbscript code
>   call myJSfunction() 'or just myJSfunction
>   ... more vbscript code
> %>

> --
> Michael Harris
> MVP Scripting




- Show quoted text -

Quote:
> Hi Everyone,

> I have an ASP page written primarily in VB Script, but have a process in
> this page that is written in JScript.  How can I announce to the server
this
> part is JScript - And then back to VB Script?

> I've tried adding
> <% Script Language ="JScript" %> - Doesn't work -
> even tried making it an #Include File which also doesn't work
> cause you can only have 1 language header.

> Any Help would be greatly appreciated.

> Matt W.



Mon, 30 Dec 2002 03:00:00 GMT  
 Mixing Script Languages
Put it in the same page...

The VBScript code can access the recordset created in the jscript function as long as it's stored in
a variable that has page level scope or is returned explicitly to the vbscript caller as the return
value of the jscript function.

Option 1:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  var myRS = ...create the rs...
  return;
  // etc...

Quote:
}

</script>
<%
  ... some vbscript code
  Dim myRS
  Call myJSfunction()
  ... more vbscript code
%>

Option 2:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  var rsvar = ...create the rs...
  return(rsvar)
  // etc...

Quote:
}

</script>
<%
  ... some vbscript code
  myRs = myJSfunction()
  ... more vbscript code
%>

--
Michael Harris
MVP Scripting

Thanks Michael, I'm assuming I can create the function right on the same
page or do I need to put it in the global.asa?

Also - The JScript creates a recordset can I call that recordset in VB
Script like normal?

Thanks Again!

Matt W.


Quote:
> Put the jscript code in a function defined something like:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   Response.Write("foobar");
>   // etc...
> }
> </script>

> Then call the jscript function where you need it.

> <%
>   ... some vbscript code
>   call myJSfunction() 'or just myJSfunction
>   ... more vbscript code
> %>

> --
> Michael Harris
> MVP Scripting




- Show quoted text -

Quote:
> Hi Everyone,

> I have an ASP page written primarily in VB Script, but have a process in
> this page that is written in JScript.  How can I announce to the server
this
> part is JScript - And then back to VB Script?

> I've tried adding
> <% Script Language ="JScript" %> - Doesn't work -
> even tried making it an #Include File which also doesn't work
> cause you can only have 1 language header.

> Any Help would be greatly appreciated.

> Matt W.



Mon, 30 Dec 2002 03:00:00 GMT  
 Mixing Script Languages
Ooops...

Option 2:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  var rsvar = ...create the rs...
  return(rsvar)
  // etc...

Quote:
}

</script>
<%
  ... some vbscript code
  Set myRs = myJSfunction()
  ... more vbscript code
%>

--
Michael Harris
MVP Scripting

Put it in the same page...

The VBScript code can access the recordset created in the jscript function as long as it's stored in
a variable that has page level scope or is returned explicitly to the vbscript caller as the return
value of the jscript function.

Option 1:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  var myRS = ...create the rs...
  return;
  // etc...

Quote:
}

</script>
<%
  ... some vbscript code
  Dim myRS
  Call myJSfunction()
  ... more vbscript code
%>

Option 2:

<script language="jscript" runat="server">
function myJSfunction()
{
  // your jscript code here...
  var rsvar = ...create the rs...
  return(rsvar)
  // etc...

Quote:
}

</script>
<%
  ... some vbscript code
  myRs = myJSfunction()
  ... more vbscript code
%>

--
Michael Harris
MVP Scripting

Thanks Michael, I'm assuming I can create the function right on the same
page or do I need to put it in the global.asa?

Also - The JScript creates a recordset can I call that recordset in VB
Script like normal?

Thanks Again!

Matt W.


Quote:
> Put the jscript code in a function defined something like:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   Response.Write("foobar");
>   // etc...
> }
> </script>

> Then call the jscript function where you need it.

> <%
>   ... some vbscript code
>   call myJSfunction() 'or just myJSfunction
>   ... more vbscript code
> %>

> --
> Michael Harris
> MVP Scripting




- Show quoted text -

Quote:
> Hi Everyone,

> I have an ASP page written primarily in VB Script, but have a process in
> this page that is written in JScript.  How can I announce to the server
this
> part is JScript - And then back to VB Script?

> I've tried adding
> <% Script Language ="JScript" %> - Doesn't work -
> even tried making it an #Include File which also doesn't work
> cause you can only have 1 language header.

> Any Help would be greatly appreciated.

> Matt W.



Mon, 30 Dec 2002 03:00:00 GMT  
 Mixing Script Languages
Thanks A Lot!  I'll try it and let you know if there's a problem.

Matt W.


Quote:
> Ooops...

> Option 2:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   var rsvar = ...create the rs...
>   return(rsvar)
>   // etc...
> }
> </script>
> <%
>   ... some vbscript code
>   Set myRs = myJSfunction()
>   ... more vbscript code
> %>

> --
> Michael Harris
> MVP Scripting




Quote:
> Put it in the same page...

> The VBScript code can access the recordset created in the jscript function

as long as it's stored in
Quote:
> a variable that has page level scope or is returned explicitly to the

vbscript caller as the return

- Show quoted text -

Quote:
> value of the jscript function.

> Option 1:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   var myRS = ...create the rs...
>   return;
>   // etc...
> }
> </script>
> <%
>   ... some vbscript code
>   Dim myRS
>   Call myJSfunction()
>   ... more vbscript code
> %>

> Option 2:

> <script language="jscript" runat="server">
> function myJSfunction()
> {
>   // your jscript code here...
>   var rsvar = ...create the rs...
>   return(rsvar)
>   // etc...
> }
> </script>
> <%
>   ... some vbscript code
>   myRs = myJSfunction()
>   ... more vbscript code
> %>

> --
> Michael Harris
> MVP Scripting




- Show quoted text -

Quote:
> Thanks Michael, I'm assuming I can create the function right on the same
> page or do I need to put it in the global.asa?

> Also - The JScript creates a recordset can I call that recordset in VB
> Script like normal?

> Thanks Again!

> Matt W.



> > Put the jscript code in a function defined something like:

> > <script language="jscript" runat="server">
> > function myJSfunction()
> > {
> >   // your jscript code here...
> >   Response.Write("foobar");
> >   // etc...
> > }
> > </script>

> > Then call the jscript function where you need it.

> > <%
> >   ... some vbscript code
> >   call myJSfunction() 'or just myJSfunction
> >   ... more vbscript code
> > %>

> > --
> > Michael Harris
> > MVP Scripting



> > Hi Everyone,

> > I have an ASP page written primarily in VB Script, but have a process in
> > this page that is written in JScript.  How can I announce to the server
> this
> > part is JScript - And then back to VB Script?

> > I've tried adding
> > <% Script Language ="JScript" %> - Doesn't work -
> > even tried making it an #Include File which also doesn't work
> > cause you can only have 1 language header.

> > Any Help would be greatly appreciated.

> > Matt W.



Tue, 31 Dec 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Mixing languages within script blocks

2. Mixing languages in .ws files - order matters

3. Mixed Language Questions (Qbasic7.1 - Assembly)

4. Mixed Language Programming

5. Problems with mixed language

6. Mixed-Language PROBLEMS - MS FORTRAN 5.00/Watcom 10.6 and PDS 7.1

7. QB45-Mixed language problems.

8. Mixed language programming: VB6 / D4 / CPPB

9. mixed language programming - visual basic calls c++ and fortran 90

10. Mixed Language Programming in VB3.0

11. Mixed Languages

12. mixing languages

 

 
Powered by phpBB® Forum Software