Javascript Tutorials
Introduction to AJAX
Javascript Form Validation
Javascript Fundamentals

Javascript Fundamentals

Output to Browser

Simple output

document.write and document.writeln are used to output text to the browser including html tags. The differences in document.write and document.writeln are document.writeln adds a line break at the end.

document.write("Text goes here");
document.writeln("<P>Or you can insert HTML tags</P>");
document.write(variablesAlso);

As you can see document.write and document.writeln can display text, html or variables.

Confirmation boxes

The javascript function confirm will open a popup box with OK and Cancel options. confirm("text to be displayed in the box");. Or var confirmSelection = confirm("Would you like to save changes?"); to set the results to a variable.

var allComplete = confirm ("Is all the information here correct?");

This example pops up a confirm box asking if all the information is correct. This is useful when verifying visitor information in a form.

Objects and Classes <<  1 2 3 4 5  >> Control Structures
New Content