reading-notes

Dynamic-web

Writing a Script for a web page

It is best to keep JavaScript code in its own JavaScript file. JavaScript files are text files (like HTML pages and CSS style sheets), but they have the . j s extension. The HTML script element is used in HTML pages to tell the browser to load the JavaScript file (rather like the link element can be used to load a CSS file). If you view the source code of the page in the browser, the JavaScript will not have changed the HTML, because the script works with the model of the web page that the browser has created.

Basic Java script instructions

A script is made up of a series of statements. Each statement is like a step in a recipe. Scripts contain very precise instructions. For example, you might specify that a value must be remembered before creating a calculation using that value. Variables are used to temporarily store pieces of information used in the script.