JavaScript Input

Two modes of JavaScript input include:

Prompts

Forms

Prompts for Input

The general syntax for the Prompt Command is:

var variable_name = prompt('Message on the box","Default Reply")

Example 1: The script

<script language="JavaScript1.2"><!--
/* This is an example of a prompt. */
var userName=prompt("Write your name in this box","Name here.");
document.write("Hello "+userName+". Welcome to my page!");
// -->
</script>

switch/case Decisions

VIII. JavaScript Object Properties

JavaScript provides functions for evaluating many of the objects of interest to Web Page Designers. Among these objects are the Math Object, the Date Object, the History Object, the Document Object, and the Navigator Object.

The Math Object

Classic HTML has virtually no math capabilities (only <SUP> and <SUB> tags). Consider the following JavaScripts: