SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2005
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using vbscript and jscript

    hi,
    i have a page of asp (jscript) but the CAPTCHA code im using is vbscript. Can i use boths languages on my page? obviosuly i cant use two language tags, is there a way around this?
    thanks

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know you can't INCLUDE jscript in vbscript or vice versa, but you might have some luck with Server.Execute

  3. #3
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes you can - just use <script runat=server language="jscript">. Example ..

    Code:
    <&#37;
    'Some VBScript code goes here
    %>
    
    <script runat=server language="jscript">
    // Your JScript code goes here
    </script>
    
    <%
    'More VBScript code
    %>
    Ian Anderson
    www.siteguru.co.uk

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's cool.

    Can you call functions written in JScript from the VBScript part?

  5. #5
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I believe so, yes. Obviously the JScript function part needs to have been created before VBScript can reference it.

    Should be very easy to test this.
    Ian Anderson
    www.siteguru.co.uk

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's great, never knew you could do that
    Code:
    <&#37;
    Function Test1()
    	Test1 = "yes"
    End Function
    %>
    
    <script runat="server" language="jscript">
    function test2() {
    	return Test1();
    }
    
    </script>
    
    <%
    Response.Write test2()
    %>

  7. #7
    SitePoint Evangelist
    Join Date
    Jul 2005
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great, cheers guys.

  8. #8
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There are some things that JScript does better than VBScript (such as array handling), so having this option can really help.
    Ian Anderson
    www.siteguru.co.uk

  9. #9
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    array handling
    Tell me about it lol.

    Plus, it's so easy to transfer complex data from javascript to server using JSON - and I have yet to see a JSON parser written in vbscript.


Bookmarks

Posting Permissions

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