Contents
Advanced JavaScript Tutorial
Advanced JavaScript Tutorial
JavaScript is Netscape's cross-platform, object-based scripting language for client and server applications. It has dominated the world of internet scripting languages for a long time now.
Uses of JavaScript
JavaScript lets you create applications that run over the internet. Using JavaScript, you can create dynamic HTML pages that process user input and maintain persistent data using special objects, files, and relational databases. You can build applications ranging from internal corporate information management and internet publishing to mass-market electronic transactions and commerce - but those are the function of server side javascript. We will not be touching that - we are more intrested in Client Side JavaScript.
The Advanced JavaScript Tutorial assumes you know the basics of JavaScript language - if you don't already know it, I would suggest to take the time to learn it now. I have written a Basic JavaScript Tutorial - and I would recommend it if you are a beginner to this language. Even if you know JavaScript, I would recommend that you take the last three chapters of the Basic JavaScript Tutorial. Feel free to jump around the basic tutorial if you already know javascript.
T-Box
If you still think that you don't need the basic tutorial, let me introduce you to a unique feature of this tutorial - The T-Box or the Test box. The readers of Basic tutorial have already met this feature.
This is a T-Box. You can type javascript commands into it and it will execute them. With this you can immediately test your knowledge after you learn about a feature of javascript. A problem with the T-Box is that it would not show an error if you mistyped some thing in it and press 'Run' - try it. Type this in the box and hit run.
aler("This is wrong")
Nothing is shown(by default). This is because there was an error('alert' is spelled 'aler') and your browser suppressed the error message. You should turn on the error notification of your browser if you wish see the errors you have made - trust me, they will be many. Just do the following for your browser.
Microsoft Internet Explorer
Choose Tools -> Internet Options, and select the 'Advanced' tab. Make sure that the 'Display a notification about every script error' is ticked. Click 'OK' to save settings.
Mozilla
Select the 'Tools -> Web Development -> JavaScript Console' or type 'javascript:' in the address bar. This will open a window that will show a list of all javascript errors. The last error in the list is the most recent one - the one you made.
Other Browsers
See browser documentation to see how this can be done.
If done correctly, the above example(aler("This is wrong")
) will show an error 'Object expected'(IE) or 'aler is not defined'(Mozilla).