A script is simpler than a program. A program is a long complex set of lines of code. Each line tells the computer what to do when a given input is provided on the keyboard or mouse. These long codes are then compiled. A compiler is a piece of software that turns programming language(code) into machine language(1's and 0's). For example, this programming code:
IF COUNT=10 Compare A to B Compare
3477 2883
GOTO DONE If equal go to C If = go to
23883
ELSE Go to D Go to 23343
GOTO AGAIN
ENDIF
would be compiled into this machine language:
10010101001010001010100
10101010010101001001010
10100101010001010010010
While the above code appears to be more complex than the HTML we have learned(it is), is follows the same logical, sequencial thought processes you have used in HTML. If you have enjoyed "tag tweaking", you will probably enjoy programming.Here is some Javascript:
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
Scripting is similar to programming in that it is more complex than a markup language and allows the user of your page to be interactive with your page(Click this and that happens, etc.). The script may be asked to do a single action or function while a program responds to many different stimuli. Scripts, however, are not compiled into machine code and remain in readable form. Secondly, a script is usually designed to run on several operating systems. Programs are compiled down to machine language to make them faster, but therefore also usually confined to a single operating system. Javascript was designed by Netscape to give their browser interactivity.
Because of the popularity of Javascript, other browsers(including archrival Internet Explorer)support most Javascript effects. It is always a good idea, as with any web document, to check your work on multiple browsers. Javascript is not Java. Java is a complex programming language that was developed by Sun Microsystems as a crossplatform language usuable on the Web. Javascript can work seamlessly with Java(see Beyond HTML: Java). to create fancier more functional webpages. Javascript is an "object oriented" language, meaning it's effects are programmed for objects such as buttons, frames, windows, etc. If you would like to learn Javascript, there is a Visual QuickStart book from Peachpit Press on the language.If you would like to steal a few ready made scripts and add them to your pages, visit the sites listed below. They all offer their scripts for free and sometimes you actually learn a little of the language by stealing and adapting.
Index
Basic Tags
Links
Design Layout
Tables
Image File Types
Using Images
Image Editing
Lists
Frames