Learning JavaScript
Now that you know HTML, CSS, XHTML and XML, you should pick up at least one more programming language to help you create cutting-edge Web pages: JavaScript.
JavaScript is used to create "applets," interactive applications within a Web page. According to w3schools.com, which has a very useful tutorial on the subject, JavaScript can also be used to validate forms, detect browsers, and more.
One of the signature features of JavaScript is the "cookie," which allows Web servers to remember who you are. According to QuirksMode, a cookie is a small text file stored on your computer that contains the following information: a name and value (who you are and what this means on a particular site) an expiry date (a date after which the cookie is no longer valid) and a domain and path (which web pages the cookie applies to).
About.com has a nice JavaScript tutorial. This tutorial, like many tutorials for Web programming languages, starts you off with a lesson that teaches you how to display the text "Hello World." This statement proves that you have the elementary programming abilities to make a Web page. The tutorial then gets more complex, with JavaScript variables, operators, functions, and quizzes to make sure you have learned each concept correctly.
One of the most important concepts within JavaScript is the conditional statement. An "if" statement tells the program to execute a particular block of code if a certain condition is met. An "if... else" statement tells the program to do one thing if one condition is met, and another thing if another condition is met. There is also the "if... else if... else" statement, which can execute an additional block of code if neither of two, or more, conditions are met.
Another useful thing that JavaScript can do is catch errors on your website. To error-proof your site using JavaScript, use the "try... catch" statement. This statement first "tries" to run a particular block of code, and if it contains an error, a second block of code will "catch" it. This prevents your users from having to find the errors themselves.
To insert JavaScript into an HTML page, use the <script> tag, followed by a </script> tag to indicate that the JavaScript part of your site is over.
Without JavaScript, it would be much more difficult to design dynamic sites that authenticate the identity of a Web user, find out which browser a viewer is using, or allow that user to play games such asBunny Hunt IV: The Good Friday Massacre.