JavaScript is an easy-to-use object-oriented script language designed for creating dynamic web page of website that link resources on both clients and servers. Netscape’s JavaScript called as the glue that holds website Web page together. This means that JavaScript will work on any platform (Windows, Linux, Mac, etc.). You don’t need any special tools to use. You can write program text editor.
Because it is completely associated with in a web browser, it is integrated with HTML. its programs are executed by a Netscape JavaScript interpreter normally built right into the web browser. When ever the Web browser requests a web page, the server sends the full web page, including HTML and JavaScript statements, over the internet to the client.
When the website web page loads on the client side web browser, HTML content is read line by line until a JavaScript opening tag is read, at which time the JavaScript interpreter takes over. When the closing JavaScript tag is reached, the HTML processing continues.
JavaScript that is handled by a client web browser is called client-side JavaScript. Netscape Navigator created server-side JavaScript to be programmed as a CGI Script , such as Perl Script or ASP Script.
We’ll be covering the following topics in this tutorial:
What is JavaScript? – History
JavaScript was originally developed by Brendan Eich at Netscape sometime in 1995–1996 Back then, the script language was called Live Script. Later on the script language was renamed to JavaScript.
What Is JavaScript Used For?
JavaScript can be used for number of different places but the most common place to use it is in a web page. JavaScript is used for creating web page programming functions. These JavaScript functions are embedded in website. JavaScript is used for making WebPages. Java Script is used for play online movies, make popup boxes, Dynamic website, web page etc.
What Can JavaScript Do?
JavaScript programs are used to detect and react to user-initiated events, such as a mouse going over a link or graphic. Java Script can improve a Web site with navigational aids. JavaScript lets you control the appearance of the web page as the document is being parsed. Without any network transmission, With Java Script you validate what the user has entered into a form before submitting the form to the server. it has string functions and supports regular expressions to check for valid e-mail addresses, social security numbers, credit card data. JavaScript also reads and writes cookie values.
JavaScript Used for Effects
It is very easy to create interesting image effects with JavaScript. JavaScript Effects such as image rollovers are common on many web sites.
JavaScript Used for Games
You can create many interesting games with JavaScript. There are basically two types of games:
* Static games
* Dynamic games
JavaScript is Used For Form Validation
Form validation is one of the most common applications of JavaScript, A classic form-related script is one that validates a form’s fields before it is submitted and cancels the submission to the server if an error is found in one of the script field. The advantage of using JavaScript in this particular example is that client-side script validation is much faster than validation via transmission to the server and back to the client.
For example, suppose you have a form-related script that accepts data from the user, including his or her e-mail address. Let’s assume that the e-mail address is essential, and that a string containing an “@” character is assumed to be a valid e-mail address.
You can choose to use client-side script validation via JavaScript. In that case the validating script is loaded as plain text (JavaScript code embedded in the HTML code). When the user clicks the Submit button, a JavaScript function is triggered to validate the form. If the e-mail address seems valid, the form is submitted to the server; otherwise, an appropriate message is immediately displayed by javascript and the submission is canceled.
What is JavaScript and how is it different from Java Technology?
Java Script is not Java. Java was developed at Sun Microsystems. JavaScript was developed at Netscape. Java applications are independent of a Web page whereas Java Script programs are embedded in a Web page and must be run in a web browser window.
Java data types must be declared. Java Script types such as variables, parameters, and function return types do not have to be declared. Java programs are compiled. JavaScript script are interpreted by a JavaScript engine that lives in the web browser . JavaScript has its own syntax script rules and expects statements to be written in a certain way.
What is JavaScript Frameworks
Many Type of Java Script frameworks available in the world. JavaScript Framework is a pre-written Script library of javascript functions and methods.Which makes the developer to produce cross web browser compliant code quickly and accurately. Most popular Java Script frameworks are: YUI, ExtJS, Prototype, MooTools and the latest one, jQuery.
What is JavaScript Prototype
Java Script is a prototype based script language. Javascript is only script languages that use prototypal inheritance. Due to Java Script Prototype, Code reuse itself is advantageous, and in Java Script prototypal inheritance is a sensible way of going about it. you can add methods and properties to any class you want anywhere anytime, even if you are not the owner of that object.
Where to Put JavaScript
Client-side JavaScript programs are embedded in an HTML document between HTML head tags <head> and </head> or between the body tags <body> and </body>. Many developers prefer to put JavaScript code within the <head> tags. And if the Java Script code is going to be long and involved, or may be reused, Script can be placed in an external file (ending in .JS) and loaded into the web page. Here is the script of JavaScript program:
<html> <head> <title>What is JavaScript</title> </head> <body bgcolor="yellow" text="blue"> <script language = "JavaScript" type="text/javascript"> document.writeln("<h2>What is JavaScript Used For</h1>"); </script> <font size="+2">What is Java Script</font> </body> </html>
Explanation
1. This is the starting tag for an HTML script document.
2. This is the HTML <head> tag. The <head> tags contain all the elements that don’t belong in the body of the document, such as the <title> tags..
3. The <body> tag defines the background color and text color of the document.
4. This <script> tag is the starting HTML tag for the JavaScript language. Java Script instructions are placed between this tag and the closing </script> tag. Java Script understands JavaScript instructions, not HTML. The JavaScript writeln function is called for the document. The string enclosed in parentheses is passed to the JavaScript interpreter. If the interpreter encounters HTML content, it sends that content to the HTML renderer and it is printed into the document on the web browser. The normal HTML parsing and rendering resumes after the closing tag is reached.
5. This is the ending Script tag.
6. HTML tags and text continue in the body of the script.
7. The body of the document ends here.
8. This is the ending tag for the HTML document.