What is javascript?

A scripting language developed by Netscape to enable Web authors to design interactive sites. Although it shares many of the features and structures of the full Java language, it was developed independently. Javascript can interact with HTML source code, enabling Web authors to spice up their sites with dynamic content. JavaScript is endorsed by a number of software companies and is an open language that anyone can use without purchasing a license. It is supported by recent browsers from Netscape and Microsoft, though Internet Explorer supports only a subset, which Microsoft calls Jscript.


Usually, JavaScript code starts with the tag

<script language="JavaScript"> and ends with the tag</script>. The code placed between <head> and </head>. Sometimes, people embed the code in the <body>tags:

You can do with JavaScript

 - Put text in an HTML page on-the-fly.

Say you want to display a nice thank you message to a user who has just submitted a comment form on your website. Obviously, the message needs to be added after the user has submitted the form.

You could let the server do that. However, if your website is very busy and your server processes hundreds of forms a day, it might take a little while for your thank you message to appear to the user.

Here’s JavaScript to the rescue. Because JavaScript runs in the user’s browser, the thank you note can be added and displayed on the page almost instantaneously, making your website users happy.

 - Make your web pages responsive.

Web environments are dynamic, things happen all the time: the web page loads in the browser, the user clicks a button or moves the mouse over a link, etc. These are called events (which will be the topic of lesson 3).

With JavaScript you can make the page immediately react to these events the way you choose: for example, by showing or hiding specific page elements, by changing the background color, etc.

 - Detect visitors’ browsers.

You can use a JavaScript script to detect the visitor’s browser, or, even better, you can detect what features a certain browser does or does not support. Depending on the browser and its capabilities, you can choose to load a page specifically tailored to that kind of browser (lesson 14).

 - Create cookies.

A JavaScript script is great if you want to create cookies so that your visitors can enjoy a personalized experience the next time they visit your website (lesson 15).

 - Validate web form data.

You can use a JavaScript script to validate form data before the form is submitted to a server. This saves the server from extra processing (lesson 16).

And much … much more.

Learning JavaScript will enable you to add cool animation effects to your web pages without using an external Flash plug-in, use the newest features of HTML5 such as canvas (to draw directly on your web page) and drag and drop capabilities, integrate your website with external web services such as Facebook, Twitter, etc.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *