|
|
What You Need, How To Get StartedJavaScript is incredibly cost effective, in that it requires absolutely nothing which is not freely available on the Internet. In fact, most computers already have most of what is needed. The tools necessary for writing JavaScript are the following:
JavaScript is a scripting language. In this case, that means that it doesn't really do anything on its own, it is dependant on a webpage. You write the JavaScript into the HTML document, usually within a Script tag. A simple example of this follows.
Try to visualize what the page will look like, and then guess what it will do. When you're ready, click on the frame below to see a preview of this HTML. Now, if you wanted to make this page, or any other page with scripts, there are several steps you would follow. This process often becomes instinctive after working with several pages.
Try it now. Open your editor and enter the script, either by copying and pasting it from this page, or typing it in. Save it, and open it in the browser. Since it has already been debugged, it should run fine. In this example, only one method of calling JavaScript code in a document is shown. For this method, the scripting language must be determined by inference. The language of the previous SCRIPT tag is used. Notice that I used double quotes on the outside, and single quotes on the inside. It doesn't matter which you use as long as you are consistent. I like to use double quotes as much as possible, and thus use single quotes to enclose these sections of code. There are other methods to do this, but this is the most commonly used and supported method for JavaScript. Further information on how to use the SCRIPT tag can be found in the SCRIPT tag syntax. JavaScript, UN-like HTML, is case-sensitive. It cares whether you use upper of lower case, except within quotation marks. document, document, and document are all treated differently. Where you place line breaks is totally up to you, other than that a string in quotes should all be on one line. After each statement, you should end it with a semicolon ";". That's how it knows where the divisions are. Also, you can group several statements together with braces "{ ... }"
|
|