Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Round Rock, Texas
    Posts
    443
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question J(ava)Script inside of VBScript?

    I want to add some javascript code in-line with existing server-side code. Can anyone show me the correct the combo of ASP tags, etc.?

    I've tried the following, which doesn't work:
    Code:
    <%LANGUAGE="VBSCRIPT"%> 
    
         ..................
    
    <%
    .........  vbscript  and ASP stuff ....
    
    <script language="Javascript" RUNAT=SERVER>
       ........  javascript code using a recordset object.........
    </script>
    
    ..... continue w/ vbscript and ASP stuff
    
    %>
    and

    Code:
    <%LANGUAGE="VBSCRIPT"%> 
    
     ...............
    
    <%
    
    .......... vbscript and ASP stuff
    %>
    <%
    <script language="Javascript" RUNAT=SERVER>
       ........  javascript code using a recordset object.........
    </script>
    %>
    
    <%
       ......... continue w/ bvscript and ASP stuff
    
    %>
    and also without any ASP tags or the <script> tag - which I knew wouldn't work; and it didn't.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can not put the <script language="Javascript" RUNAT=SERVER> tags within the asp without doing
    <%
    Response.Write("<script language="Javascript" RUNAT=SERVER>")
    %>
    Last edited by whammy; 08-08-2002 at 01:32 AM.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you close the asp delimiters you can put the javascript anywhere since it's run on the server side:


    <% @Language="VBScript"%>
    <script language="javascript" runat="server">
    // code here
    </script>

    <% 'More ASP code here! %>

    Then it should work... works for me.
    Last edited by whammy; 08-08-2002 at 01:33 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •