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");As you can see document.write and document.writeln can display text, html or variables.
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.