Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   What is the difference between VB script and Java script? (http://www.go4expert.com/forums/difference-vb-script-java-script-t14433/)

newage123 8Oct2008 11:57

What is the difference between VB script and Java script?
 
Which one is the better tool for client side validation? I am using java script .Can any one suggests which one is the better?
NJ website development

shabbir 8Oct2008 15:48

Re: What is the difference between VB script and Java script?
 
Please confine links to signatures only

juresh 16Oct2008 15:12

Re: What is the difference between VB script and Java script?
 
I using java script for client side validation.
i think it is easy to handle.

Jenniferlinn 26Dec2008 16:40

Re: What is the difference between VB script and Java script?
 
There are 2 common scripting methods used in the development of web pages that are more interactive. These 2 methods are known as Client-Side and Server-Side Scripting. With Client-Side Scripting, the scripts on the page are processed by the individual web browser that requests the page. With Server-Side Scripting, on the other hand, all scripts are processed on the server before the requested page is ever sent to the browser. This results in no actual code being sent to the client’s machine.

One of the most popular methods used to create today’s modern dynamic web pages is Server-Side Scripting languages. These dynamic pages are constructed in such a way that all server processes take place before the page is delivered to the user. This means that you only need the most basic internet browsing software to view the most complex and dynamic pages on the web today.

Contrary to Server-Side scripts, Client-Side scripts can only run on browsers that support the specific scripting language that you are using. This means that you would need Netscape Navigator to view fully functioning JavaScript (I in fact learned this lesson the hard way in this very class.) On the contrary, you would need Internet Explorer to view fully functioning VB Script.

Server-Side Scripting has made it possible to “create platform-independent, easily deployable applications” (Rahmel). The thought of creating a program or application that will run anywhere in the world has obvious advantages over Client-Side Scripting. If you have ever written a research paper at the computer lab on a PC, while your computer at home is a Macintosh, you can surely relate to this. Scripting Engines seek to resolve the problem of having no functioning application code on the client. Because the script code is embedded in the HTML, it is downloaded every time the page is accessed (Rahmel).

I feel that it is important to note that my comparisons between JavaScript and VB Script are meant to be relevant only to Server-Side Scripting uses. Both languages can be used for Client-Side scripting purposes, however that is not the topic of this discussion and is a cold-blooded debate as old as the battle between Netscape Navigator and Internet Explorer (or PC versus Macintosh).

I am proposing that VB Script is a better choice for the development of Server-Side Internet Applications, and I intend to provide evidence supporting why I feel this way. Coming from a background that consists primarily of design, my comparisons of the two are not biased in any way, as they are both foreign to me. One of the main questions I asked when analyzing these languages is “How quickly can I get up and running with fully functioning code, taking into considerations such factors as support, learning curve, etc?”

I am well aware that many programmers and developers will cringe at the fact that I am willing to put my stamp of approval on a product that was developed by the Microsoft Machine, but I am prepared to face such scrutiny. It is impossible to deny that although this can be a disadvantage, the widespread support options available are hard to ignore.

Part of the reason that support for VB Script is so easily attainable is because the syntax is based on that of Visual Basic. In fact, “VB Script is identical, syntactically and grammatically, to Visual Basic and Visual Basic for Applications” (Thurott). There are literally millions of Visual Basic Developers who can instantly become web developers without much of a learning curve.

JavaScript, on the other hand, is not truly based on any other language. Despite use of the phrase “Java” in the name, it has absolutely nothing to do with it at all. In fact, the original name of JavaScript was LiveScript, but the name was changed at the last minute by the developers at Netscape, “so that Netscape could feed off the success of Java, like some fish hanging off the belly of a shark” (Thurott).

VB Script was created specifically for use on the internet, and is designed to be as close as possible to a programming language that is probably the most popular ever created (Hatfield, P. 21). VB Script doesn’t use lots of strange brackets and symbols in its logic. In fact, it often has a strong resemblance to another popular language known as English. Consider the basic example below

The VB Script Example:

Dim x
For x = 1 to 10
document.write x & “<BR>”
Next

Now let’s look at the same example written using JavaScript:

var x;
for(x = 1; x <=10; x++)
{
document.write(x + “<BR>”);
}

Immediately you will notice that there is an abundance of semicolons, parentheses and brackets in the JavaScript code. These characters are mandatory – the code simply will not work without them. I assure you that few things are more frustrating than spending hours trying to debug code where the only problem was a missing semicolon or bracket. To make matters worse, in my own personal experience I have found that the semicolons may actually NOT be needed in every instance, and may cause problems at certain times. I have been unable to figure out why this is sometimes the case, but it seems almost random.

You may have noticed that the VB Script code uses capitalized letters at the beginning of the lines. These are not mandatory, and in fact you could switch between the upper and lower case right in the middle of the same code! JavaScript, on the other hand, is case-sensitive. If you create a variable named “count”, then you had better not refer to it as “Count” 20 lines down. VB Script could care less if you capitalize. It’s smart enough to figure out that they are in fact one and the same.

JavaScript does share some basic syntax with Java, C, and C++, however, the way that JavaScript handles variables and objects is absolutely nothing like Java, C, and C++. At least with JavaScript there is a bright side – comments are handled exactly the same way as they are in C, C++, and Java!

There are numerous built-in functions available to VB Script that are not native to JavaScript. All of these functions are instantly available to you to use in your coding. Nearly every function you wish to use in JavaScript you must first create.


All times are GMT +5.5. The time now is 13:31.