This is JavaScript program demonstrates how to create simple output messages and message boxes.
<!DOCTYPE html>
<html>
<body>
<h1>Basic Output</h1>
<h2>1. Using write versus writeln</h2>
<hr />
<h3>A new line is not added at end of each write().</h3>
<pre>
<script>
document.write("In the beginning ");
document.write("God created the heavens and the earth.");
</script>
</pre>
<h3>A new line is added at end of each writeln().</h3>
<pre>
<script>
document.writeln("In the beginning ");
document.writeln("God created the heavens and the earth.");
</script>
</pre>
<h4>Note: A pre element is needed to see a new line character</h4>
<hr />
<h2>2. Using an alert to create a message box pop up</h2>
<script>
alert("In the beginning God created the heavens and the earth.");
</script>
</body>
</html>
© 20072025 XoaX.net LLC. All rights reserved.