JavaScript
What is JavaScript?
JavaScript is a programming language that allows website developers to control aspects of a webpage after it has loaded.
Why does this site use JavaScript
There are several reasons we use JavaScript.
- Flash
- Asynchronous JavaScript (AJAX)
- Browser-specific Decision-making
- Event Management
- Dynamic Document Manipulation
Flash
We use JavaScript to load our Flash elements. JavaScript helps us make sure you can display the Flash animation or video before we load it, and if you can't, it allows us to tell you how to update your Flash plugin in order to be able to enjoy our Flash content.
AJAX
One of the most useful aspects of JavaScript is its ability to load information asynchronously. What that means is that a web page can load with only the most important information. After the page loads, you can then load whatever information you want. Therefore, instead of loading 10 different items, you only load the two items that you actually want to see.
An example of this is our login and search buttons at the top of the page. Instead of loading all of the information that comes with those buttons every time you visit any page, we tell the buttons to load only when you click them.
Browser-specific Decisions
There are many, many different web browsers available right now. Additionally, there are hundreds of different screen sizes and resolutions, and hundreds of different computer manufacturers with several different operating systems all visiting our site. For the math nerds out there, let's assume there are 5 browsers, 100 screen sizes, 50 computer brands, and 3 operating systems. A little permutation provides that there are 75,000 different combinations with which people intend to access this website, and that's a very conservative estimate. We have to try to make them all happy.
JavaScript allows us to use information about your browser, screen size, etc to determine how to display the website for you.
Event Management
In the world of websites, an event is something that happens within a website at runtime (or after the page loads). Events can be as general as a mouse movement or as specific as clicking a button. Essentially, the ability to manage these events allows us to control what happens as you navigate our site.
Dynamic Document Manipulation
A modern web page is based on a standard called the Document Object Model (DOM). The DOM allows JavaScript to access every element on a page from a single word to the page itself. The DOM also allows for the creation and removal of elements whenever it is necessary. For example, when you click the search link at the top of the page, a box is created and filled with the search form. When you click anywhere else on the page, it removes the search box.
This is important for efficiency's sake. Basically, the more items on a page, the more memory is drained by keeping these active. If we can get rid of elements that aren't being used, we can save some strain for your computer.
