Javascript Tutorials
Introduction to AJAX
Javascript Form Validation
Javascript Fundamentals

Javascript Fundamentals

Functions and Methods

Javascript functions operate like functions in other languages. Declared by the function statement. Function functionName (parameters,go,here) { }. Methods are actions associated with objects. An example method is submitting a form, this can be accomplished by using document.formName.submit().

function functionName(parameter1,paramater2) {
var varName = parameter1;
var newVariable = varName + parameter2;

In the above example we created a function called functionName. This function sets varName to parameter1 and then adds varName and parameter2 together and stores the result in newVariable.;
document.write("test string");

Here we displayed the open, write, and close methods of the document object. opens an output stream to store text in following document.write statements. Once document.close is called the text collected through the write statements are displayed to the browser.

Output to Browser <<  1 2 3 4 5
New Content