Introduction of JavaScript for beginners
Introduction of JavaScript for beginners
What is JavaScript?
JavaScript is the scripting language designed for web pages that describes data and procedures in terms of objects, methods, and properties. JavaScript consists of lines of executable computer code. It is case sensitive and its code is integrated directly into common HTML documents as it was designed to add interactivity to HTML pages.
JavaScript has been integrated into various platforms and applications since its initial integration into web browsers. All over the world programmers do using JavaScript to program the Microsoft Windows shell as well as in Microsoft’s server-side application framework, Active Server Pages plus so many other such applications. It is considered to be the most popular scripting language on the Net. JavaScript can enhance the design structure of web pages by enabling calculations, checking forms, writing interactive games effects, customizing data binding, and more.
A glimpse of JavaScript history
In order to make web pages more interactive, team of developers at Netscape and Sun Microsystems in 1995 created JavaScript; it was then called “LiveScript”. European Computer Manufacturers Association (ECMA) in 1998 adopts JavaScript 1.1 as standard Internet scripting language and hence the incompatibilities in scripting between various browser implementations has been resolved. Then the standard was called ECMAScript, though the common name, JavaScript remain persisted. The current version of JavaScript is 1.5.
Difference between Java and JavaScript?
Although the names are much alike still Java and JavaScript don’t have anything in common. They are the two completely different languages in both concept and design. Java is created by Sun Microsystems is a lot more powerful, more complex computer language and belongs in the same category as C, C++. In case of Java program, you need to compile before you can run it, whereas with JavaScript, no compilation is needed. You simply have to open up a text editor; type it, save it, and your browser will be ready to run it immediately thereafter. In order to get the better idea of JavaScript’s capability you should better visit Google Maps or Google’s Gmail service site.
Knowledge required to understanding JavaScript Quickly
Before start working on JavaScript you need to remember few things. You need to have a basic knowledge of HTML/XHTML. Its not that to getting expertise but as JavaScript can be used to dynamically create web pages so the basics of using HTML elements and attributes plus little knowledge of CSS will certainly help better.
JavaScript Basics
In order to insert JavaScript into an HTML page, you’ll have to use <script> tag. You can also write the attribute types to define the kind of scripting language to make the specific kind of effects.
So, the command of the format <script type=”text/javascript”> and </script> tells where the JavaScript starts and ends. For instance
<html> <body> <script type=”text/javascript”>
document.write(”Introduction of JavaScript for beginners”)
</script>
</body> </html> |
This will produce the output on an HTML page as:
| Introduction of JavaScript for beginners |
Standard JavaScript command for writing output to a page isâ€document.writeâ€. By entering the document.write command between the <script type=”text/javascript”> and </script> tags, the browser do recognizes it as a JavaScript command and execute the according code line to produce necessary effects.
Common uses of JavaScript
As JavaScript is a scripting language with a very simple syntax means almost anyone can put small “snippets” of code into their HTML pages. It usually used for the following purposes:
v JavaScript is used to put dynamic text into HTML pages. A statement of this form “<h1>” + name + “</h1>” can write a variable text into an HTML page.
v JavaScript can be used effectively to react to events. Like it can be set to execute when something happens, like when a user clicks on an HTML element or when a page has finished loading.
v JavaScript can be used to validating input to fields before submitting a form. For instance, like validating the entered email address to see if it has an @ in it, since if not, it’s not a valid address. This way it saves the server from extra processing
v You can use JavaScript to read, write and change the content of HTML elements.
v JavaScript can be used to detect the browser of visitor and depending on the browser; another page specifically designed for that browser can then be loaded.
v A JavaScript can be used to store and retrieve information automatically on the visitor’s computer. This technique is called “cookies”.
v You can also use it to control browsers. You can open pages in customized windows, where you specify if the browser’s buttons status line or menu line should be present or not.
JavaScript is most commonly used as a client side scripting language means that its code is written into an HTML page. Whenever a user requests an HTML page with JavaScript in it, the script is sent to the browser and it’s up to the browser to do something with it. It’s the secret that most webpage developers use to keep you glued on their websites as it has made sites more colorful, exciting and more interactive.
The Author is the owner of a Web Site Design Company, and providing Web Design and Development Solutions to clients across USA and UK for affordable and sensible prices.
4 Responses to “Introduction of JavaScript for beginners”
Leave a Reply
You must be logged in to post a comment.
Nice article.
Google is the best search engine. I like google a lot.
I was reading your article posted on http://www.buzzle.com and cant stop myself from visiting you website to read more of your articles. Keep up the great work
Hi Arjun,
Please keep visiting and posting you valuable commnets.