Thursday 17 October 2013

Introduction to JavaScript and Introduction to Jscript

Introduction to JavaScript and Introduction to Jscript

JavaScript in a programming language and it is specifically made for the web browsers to use. It is used in HTML to create interactivity between the web pages. There is a very similar language called Jscrpit which is made by Microsoft. Microsoft has provided a version of Jscript for the desk top users it means for the local use in a machine and it can be used with the help of Windows Script Host (WSH).
The Windows Script Host (WSH) is an optional scripting environment that supplies Windows operating systems with the capability to run scripts directly on the Windows desktop. Both languages support the same collection of programming statements.
JavaScript and JScript are interpreted languages. This means that scripts written in these languages are not compiled before they are executed (as is typical of most programming languages such asC++). Every script statement must first be converted into binary code (a computer language made up of 0s and 1s that the computer can understand) in order to execute. Unlike complied programs, which are converted to binary code in advance, JavaScript and JScript statements are processed at execution time. This means that they run a little slower than compiled programs. The upside is that this makes writing and testing JavaScripts and JScripts very intuitive and easy. You simply write a few lines of code, save your script, and test it without having to stop and compile it into executable code.
Both JavaScript and Jscript are object-based scripting languages not truly object oriented languages. They have almost everything as object. Everything in JavaScript is an object, for JavaScript a browser, a window, a button etc are objects. JScript has access to a different set of objects. For example, JScript has the capability to access objects such as files, drives, and printers.
Every object has properties, and you can use JavaScript and JScript to manipulate these properties. For example, with JavaScript you can change the background color of a browser window or the size of a graphic image. In addition to properties, objects have methods. Methods are the actions that objects can perform. For example, JavaScript can be used to open and close browser windows. By manipulating their properties and executing methods, you can control objects and make things happen.
JavaScripts support event-driven programming. An event is an action that occurs when the user does something such as click on a button or moves the pointer over a graphic image. JavaScript enables you to write scripts that are triggered by events. Did you ever wonder how buttons dynamically change colors on some Web sites when you move the mouse over them? It's simply a JavaScript technique known as a rollover. The event is the mouse moving over the button (object). This triggers the execution of an event handler, which is a collection of JavaScript statements that replaces the button with another one that uses a different color.

JavaScripts and JScripts that run inside Web browsers have access to objects placed on Web pages. On the other hand, JScripts that run within the WSH have access to desktop resources such as toolbars, files, printers, and the Windows registry.

No comments:

Post a Comment