# The Computer Revolution/Programming/JavaScript
## What is Scripting Language?

Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard. Thus, scripts are often distinguished from programs, because programs are converted permanently into binary executable files (i.e., zeros and ones) before they are run. Scripts remain in their original form and are interpreted command-by-command each time they are run. Scripts were created to shorten the traditional edit-compile-link-run process. The name 'script' is derived from the written script of the performing arts, in which dialogue is set down to be interpreted by actors and actresses--the programs. Early script languages were often called batch languages or job control languages. Scripting languages can also be compiled, but because interpreters are simpler to write than compilers, they are interpreted more often than they are compiled.

## What is JavaScript?

Java script is a compact object-based scripting language for developing client and server Internet applications. Netscape Navigator interprets JavaScript statements embedded in an HTML page, and LiveWire enables you to create server-based applications similar to Common Gateway Interface (CGI) programs. Basically JavaScript is a program that assists interactivity with HTML pages. For example: Black Board quizzes for College students. JavaScript support is built right into all the major web browsers, including Internet Explorer, Google Chrome, Firefox and Safari. Provided that the visitors to your site are using web browsers that support JavaScript (most do) and have JavaScript enabled (it is by default), then your JavaScript will run when they visit the page. There are plenty of pre-written JavaScripts that people have made available for you to plug straight into your web page. All you need to know to be able to use such scripts is how to paste the supplied code into the required places in your web page.

## What can a JavaScript Do?

* JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages
* JavaScript can put dynamic text into an HTML page - A JavaScript can write a variable text into an HTML page
* JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element
* JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element
* JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
* JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser
* JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer
Reference: http://www.w3schools.com/js/js_intro.asp retrieved March 27, 2007
To better handle Web page interactivity, a new set of Web standards-called AJAX (Asynchronous JavaScript and XML) has been developed. AJAX is used on many Web sites. AJAX is used on Google Maps, Gmail & many other Web applications. It creates a faster and more efficient interactive Web applications. For AJAX to be faster than just JavaScript when you reload a Web page, AJAX applications request only new data and add the data to the existing Web page. By doing this, when it’s refreshed less content needs to be downloaded each time the Web page changes. This is how AJAX saves time.

## Summary of JavaScript

| Creation | Best Uses | Alternatives |
| any text editor resides within HTML code | client side interactive forms dynamic content for pages opening specific sized web browser windows determining browser features in-page animation navigation menus | Shockwave, Flash for animation CGI programming for forms Java, in time |
| Advantages | Disadvantages |
| interactive forms w/o CGI off-line interactive pages no creation software required fast test and modify cycle built-in feature in modern browsers many free resources | more complex than HTML adds file "weight" to HTML files cross-platform issues |
Reference: http://www.mcli.dist.maricopa.edu/show/interact/js.html , retrieved March 27, 2007

### Common JavaScript Syntax

http://www.ilovejackdaniels.com/javascript_cheat_sheet.pdf