Results 1 to 15 of 15

Thread: Java vs VBScript

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    84

    Java vs VBScript

    When I am using VBscript in HTML-code I can recieve text from e.g. a textbox with this code:

    <%var1=request.form("theText")%>
    or
    <%var1=request.querystring("theText")%>

    Can this be done in JavaScript, or must I use Perl or cgi or something else if I want it to work on Netscape ??

  2. #2
    Member
    Join Date
    Mar 2002
    Location
    Amsterdam
    Posts
    51
    The question is not wholly clear to me. In server processing, HTML is sent to a browser, and it does not matter whether a user is using IE or NetScape.

    For serverside processing on a WebServer with an ASP engine you can use both VBScript and JavaScipt, though I have no experience with JavaScript. But I know it is possible and you can approach the Request-object.

  3. #3
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    If the server is set up for it, you can also use PerlScript for ASP processing......

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Javascript only works on with the current page loaded as it works client side, not server side. If you want to get data from a form client side use the document object modal.

    <script language="javascript" type="text/javascript">
    function displayItems(){

    for (i=0;i=document.form1.elements.length;i++){
    alert (document.form1.elements[i].value);
    }

    }
    </script>

    <form name="form1">
    <input type="text" name="text1">
    <input type="text" name="text2">
    <input type="text" name="text3">
    </form>

    or you can reference an Item directly : -

    <script language="javascript">
    alert (document.form1.text1.value);
    </script>

    but this is only client side. You cant hit the forms submit button and use javascript to get data from the form, only something like ASP, PHP or CGI/Perlscript will work as it works with the Server.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You can't do what you are trying to do in this way. *ALL* Server side code executes before the html is sent to the browser. To get values from the client side DOM you have to either submit the data back to the page and get it from the Request.Form collection or use querystrings to re-request the page, passing the values in the URL line and get them from the Request.Querystring collection.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    84
    Yes, but can that be done in JavaScript ??

  7. #7
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Abel, I'm afraid there is a basic understanding of web technologies that you lack. Let's make this as simple as possible.

    What are you trying to do?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  8. #8
    Member
    Join Date
    Mar 2002
    Location
    Amsterdam
    Posts
    51
    Yes you can, but why do you want to use Serverside JavaScript?
    Please explain!

    Assumedly, using Javascript on the server, will give you the same handicap. The Request object is approachable with any valid serverside language, but not from the client without making a new call. Like Monte96 said, any serverside processing happens before the HTML is sent to the browser.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    84
    I know that I'm not that good at writing asp-code.

    I have a page with a textbox and a submit-button.
    The user writes his name in the box and press the button. Then a new page will be loaded which says "Hi James" (if he filled in James in the textbox)
    I have made this using VbScript, but couldn't do it using JavaScript.
    Can it be done ??

  10. #10
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I would imagine it can.

    Now do you realize that this will be using server-side JavaScript, and not client-side JavaScript?

    If so, then go to developer.netscape.com and look for the documentation on server-side JavaScript.

    Are you moving away from ASPs?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  11. #11
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    Is this what you want?
    Code:
    <script language="javascript">
    Function checkUser()
    {
         var1 = "<%=request.form("txtUser")%>"
    
         if (va1!="")
              alert("Hi " + var1);
    
    }
    </script>
    seoptimizer2001
    VB 6.0, VC++, VI, ASP, JavaScript, HTML,
    Perl, XML, SQL Server 2000

    If God had intended us to drink beer, He would have given us stomachs.


    Please use the [code] and [vbcode] tags in your posts!
    If you don't know how to use them please go HERE!


  12. #12

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    84
    Well, I'm trying to build an own community (very small), just to see if I can make it. I build one using VBScript, but since you must have Explorer then I wanted to build it in some other language and thought of JavaScript.

  13. #13
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Client side VBScript only works with Internet Explorer BUT ASP works server side so it works with any browser. The ASP interpreter (not sure if this the corrent word in this case ) takes the ASP source code and displays it as HTML. Thats why you take a look at the source code, in a browser, in any ASP page, it displays it as HTML and not your ASP code.

    If you really want to try another language try installing PHP and learning a bit of that, its similar to ASP, but has similar syntax to Javascript.

    You might have a bit of luck with server-side Javascript but I recommend staying away from it.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    84
    Ok, thanks for all help.

  15. #15
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    ASP supports JScript, which is Microsoft's "interpretation" of javascript, so you could do that if you like javascript syntax better than VBScript syntax.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

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