JavaScript
JavaScript is a light weight and very simple Scripting Language that has Object Oriented capabilities and most importantly it is a cross platform Scripting Language. These scripts can be integrated directly into the HTML code. I am pretty sure some of you must be thinking JavaScript has something to do with the Java programming language. Actually it has nothing to do with Java and these two are completely different from each other. JavaScript was originally developed by Netscape. In that time Java was a very popular programming language through out the industry. And the funny thing is, JavaScript got it named as JavaScript by Netscape as a marketing strategy to increase the popularity of JavaScript language. Anyhow I don't want to remind you, now JavaScript is one of the most popular Scripting Languages. Here is a simple example showing a text in a web page using JavaScript.
<html>
<body>
<script type="text/javascript">
{
document.write("Hello JavaScript");
}
</script>
</body>
</html>
JScript
Actually JScript is just the Microsoft's version of JavaScript. Microsoft thought of implementing their own version of JavaScript and they named it as JScript. But in some situations JScript is not behaving like JavaScript. I will give you a simple example. Let's declare a variable called temp in JavaScript code and create a object within the page having the field id as "temp".
var temp = 'Hello';
And trying to set the value of object temp in the page to the value of variable temp.
document.getElementById('temp').innerHTML = temp;
In here, JavaScript is working fine, but the JScript gives a error. The reason behind this is, in here JScript does not recognize the difference between var temp and document.getElementById('temp'). So he treats as both of them are referring to one single object. But JavaScript recognises the temp variable and the object within the page having id "temp" as two entirely separate fields. So that is a one significant difference between JavaScript and JScript. Another one is JScript supports additional commands that allow access to ActiveX and the local computer when comparing to JavaScript. But these commands are intended for use on intranet sites and for the browser Internet Explorer.
Anyway here is a simple example showing a text in a web page using JScript.
<html>
<body>
<script type="text/JScript">
{
document.write("Hello JScript");
}
</script>
</body>
</html>
VBScript
VBScript is Microsoft's Scripting Language just as JScript. It is actually a child of Microsoft's Visual Basic for use with web pages and other applications that uses Microsoft ActiveX controls. VBScript is very similar to JavaScript, but VBScript syntaxes are more similar to Visual Basic.
Comparison of JavaScript and VBScript
Similarities
- Both languages are easy to learn and do not require any expensive development tools.
- Both can be used to enhance web pages.
- Both can abuse and run malicious scripts on clients' machines.
- JavaScript is the default scripting language for browsers but VBScript must be specified as the scripting language.
- JavaScript has cross-platform support from all popular browsers while VBScript is supported MS IE only. VBScripters would thus loose a sizable audience.
- One of the most significant issues with JavaScript is that there were different releases of the language since its inception (version 1.0). Similarly, different versions of browsers exist on users machines. Therefore, code written for one version may not necessarily work on another. More testing would be necessary thus, development time increases.
- JavaScript is case sensitive but VBScript is not this would not be prone to as many syntax errors like missing >
- JavaScript uses the same character for concatenation as it does for addition (the + character) while the '&' concatenating character is used in VBScript. This is another source of errors in JavaScript.
<html>
<body>
<script type="text/vbscript">
{
document.write("Hello VBScript");
}
</script>
</body>
</html>
Hope you learn something about JavaScript, JScript and VBScript out of this post. Feel free to correct me and leave your comments.
Happy Coding.
Regards,
Jaliya