Results 1 to 13 of 13

Thread: ASP using javascript instead of VBScript

  1. #1

    Thread Starter
    Hyperactive Member MetallicaD's Avatar
    Join Date
    Feb 2001
    Location
    Tallahassee, FL
    Posts
    488

    ASP using javascript instead of VBScript

    Hey all, does anyone know of some good sites with tutorials on how to use javascript for server-side script?

    Thanks
    -Matt
    [vbcode]
    '*****************************
    MsgBox "MCD :: [email protected]", vbInformation + vbOKOnly, "User"
    '*****************************
    [/vbcode]

  2. #2
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Try this site!

    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

  3. #3
    chenko
    Guest
    You talking about JSP? I havnt seen any articles on that at PSC..... oh well, I know now

    And I think its Java, not JavaScript

  4. #4

    Thread Starter
    Hyperactive Member MetallicaD's Avatar
    Join Date
    Feb 2001
    Location
    Tallahassee, FL
    Posts
    488
    No, i am actually talking about using the javascript as the serverside language, but on Microsofts ASP technology (not JSPs which use java). I know this isnt common and the vast majority is done by VBScript..

    Thanks
    -Matt
    [vbcode]
    '*****************************
    MsgBox "MCD :: [email protected]", vbInformation + vbOKOnly, "User"
    '*****************************
    [/vbcode]

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    <% LANGUAGE="JavaScript" %> Should do the trick.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Hyperactive Member MetallicaD's Avatar
    Join Date
    Feb 2001
    Location
    Tallahassee, FL
    Posts
    488
    Thanks parksie, i realize this.. but what i am looking for is a tutorial or examples of database connectivity and dealing with the request and response objects with javascript..

    Thanks
    -Matt
    [vbcode]
    '*****************************
    MsgBox "MCD :: [email protected]", vbInformation + vbOKOnly, "User"
    '*****************************
    [/vbcode]

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Oops sorry
    ActiveConnection, CommandText, CommandTimeout, CommandType, Size, and Direction Properties Example (JScript)
    [This is preliminary documentation and subject to change.]
    This example uses the ActiveConnection, CommandText, CommandTimeout, CommandType, Size, and Direction properties to execute a stored procedure. Cut and paste the following code to Notepad or another text editor, and save it as ActiveConnectionJS.asp.

    <!-- BeginActiveConnectionJS -->
    <%@LANGUAGE="JScript"%>
    <%// use this meta tag instead of adojavas.inc%>
    <!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->

    <html>
    <head>
    <title>ActiveConnection, CommandText, CommandTimeout, CommandType, Size, and Direction Properties</title>
    <style>
    <!--
    BODY {
    font-family: 'Verdana','Arial','Helvetica',sans-serif;
    BACKGROUND-COLOR:white;
    COLOR:black;
    }
    .thead {
    background-color: #008080;
    font-family: 'Verdana','Arial','Helvetica',sans-serif;
    font-size: x-small;
    color: white;
    }
    .thead2 {
    background-color: #800000;
    font-family: 'Verdana','Arial','Helvetica',sans-serif;
    font-size: x-small;
    color: white;
    }
    .tbody {
    text-align: center;
    background-color: #f7efde;
    font-family: 'Verdana','Arial','Helvetica',sans-serif;
    font-size: x-small;
    }
    -->
    </style>
    </head>

    <body bgcolor="White">

    <%
    var iRoyalty = parseInt(Request.Form("RoyaltyValue"));
    // check user input

    if (iRoyalty > -1)
    {
    // connection and recordset variables
    var Cnxn = Server.CreateObject("ADODB.Connection")
    var strCnxn = "Provider=sqloledb;Data Source=" + Request.ServerVariables("SERVER_NAME")+ ";" +
    "Initial Catalog=pubs;User Id=sa;Password=;"
    var cmdByRoyalty = Server.CreateObject("ADODB.Command");
    var rsByRoyalty = Server.CreateObject("ADODB.Recordset");
    var rsAuthor = Server.CreateObject("ADODB.Recordset");
    // display variables
    var filter, strMessage;

    // open connection
    Cnxn.Open(strCnxn);

    cmdByRoyalty.CommandText = "byroyalty";
    cmdByRoyalty.CommandType = adCmdStoredProc;
    cmdByRoyalty.CommandTimeOut = 15;

    // The stored procedure called above is as follows:
    // CREATE PROCEDURE byroyalty
    // @percentage int
    // AS
    // SELECT au_id from titleauthor
    // WHERE titleauthor.royaltyper = @percentage
    // GO

    prmByRoyalty = Server.CreateObject("ADODB.Parameter");
    prmByRoyalty.Type = adInteger;
    prmByRoyalty.Size = 3;
    prmByRoyalty.Direction = adParamInput;
    prmByRoyalty.Value = iRoyalty;
    cmdByRoyalty.Parameters.Append(prmByRoyalty);

    cmdByRoyalty.ActiveConnection = Cnxn;

    // recordset by Command - Execute
    rsByRoyalty = cmdByRoyalty.Execute();

    // recordset by Recordset - Open
    rsAuthor.Open("Authors", Cnxn);


    while (!rsByRoyalty.EOF)
    {
    // set filter
    filter = "au_id='" + rsByRoyalty("au_id")
    rsAuthor.Filter = filter + "'";

    // start new line
    strMessage = "<P>";

    // get data
    strMessage += rsAuthor("au_fname") + " ";
    strMessage += rsAuthor("au_lname") + " ";

    // end line
    strMessage += "</P>";

    // show data
    Response.Write(strMessage);

    // get next record
    rsByRoyalty.MoveNext;

    }

    //clean up
    rsByRoyalty.Close;
    rsAuthor.Close
    Cnxn.Close
    }
    %>

    <hr>


    <form method="POST" action="ActiveConnectionJS.asp">
    <p align="left">Enter royalty percentage to find (e.g., 40): <input type="text" name="RoyaltyValue" size="5"></p>
    <p align="left"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>
    &nbsp;


    </body>

    </html>
    <!-- EndActiveConnectionJS -->
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Isn't JScript supposedly faster than VBScript?
    Alcohol & calculus don't mix.
    Never drink & derive.

  9. #9
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    yeah, and JScript, and java script are not the same thing!

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  10. #10
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    here, this site is and interesting article about JScript VS. VBscript

    http://msdn.microsoft.com/library/de...tml/vbsvjs.asp

    It's written by microsoft though...

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  11. #11

    Thread Starter
    Hyperactive Member MetallicaD's Avatar
    Join Date
    Feb 2001
    Location
    Tallahassee, FL
    Posts
    488
    Not the same... JScript was from Microsoft and Javascipt was developed by Netscape..

    another question should be asked.. is Jscript as widely used as javascript? will browsers like Netscape and Opera support it the same way as javascript is supported?

    -mcd
    [vbcode]
    '*****************************
    MsgBox "MCD :: [email protected]", vbInformation + vbOKOnly, "User"
    '*****************************
    [/vbcode]

  12. #12
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    JScript might as well be JavaScript.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  13. #13
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    Technically IE doesn't support javascript, it supports JScript. JScript has many more capabilities than javascript, and is a lot like VBScript.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

Posting Permissions

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



Click Here to Expand Forum to Full Width