80 likes | 252 Views
Introduction to JavaScript. AWAR4S May 2012. What Is JavaScript?. JavaScript (Often referred to as JS) is a programming language which is run by web browsers. With JavaScript, you can get visitors to your site to run programs in their browser. Some facts:
E N D
Introduction to JavaScript AWAR4S May 2012
What Is JavaScript? JavaScript (Often referred to as JS) is a programming language which is run by web browsers. With JavaScript, you can get visitors to your site to run programs in their browser. Some facts: • JavaScript IS NOT Java! They are two different languages. • JavaScript had two competing forms for a while, until a standard was agreed upon. The standard form of JavaScript is called ECMAScript.
Why Use JavaScript? If you have used a modern browser, odds are very good that you’ve already run JavaScript programs in your browser: • JS can check whether info entered into a web page is correct or not. • JS can produce ‘spinners’ which you see when pages are being loaded. • JS can produce animations which look like Flash but which don’t require the Flash player. • JS can allow web pages to do math tasks such as having online calculators, online graphing, etc.. • JS can talk with databases when you either store or retrieve settings from a web page, such as an online shopping page.
JavaScript In Brief… To include JS code in a web page, you must use the <script> and </script> tags. For example: <html> In the web page, but not in your program… <script> //This is where your Code will go! </script> Still in the web page, but not in your program… </html>
Online JavaScript Tutorial Pages As we have seen with HTML and CSS, the w3schools pages have a lot of useful info on JavaScript. The starting URL for their tutorial is found at: http://www.w3schools.com/js/default.asp (We will be looking at selections from the JavaScript topics, not necessarily all of them…)
Your Task • If you have experience in a programming language such as C, C#, Java, or Visual Basic, JavaScript should be easy to adjust to. • For those with a more Graphics-related background, this first assignment will introduce the basic concepts of how to set up JS code, where it belongs in a web page, and how to include JS comments in your code.
Your Task, Continued… Please go to the URL: http://www.w3schools.com/js/default.asp , and read through the first five topics on the right: • JS Introduction • JS How To • JS Where To • JS Statements • JS Comments
Your Task, Continued… NOTE: • The Tutorial authors seem to have all of their code between <script> and </script> tags. For LARGE scripts, or scripts which have to be shared between two or more pages, LINKS to separate JS files should be used! This is the same format which is used for CSS code… • Additional features of JS can be used when pages are written using HTML5. This is another reason to make your pages Validated in HTML5!