JS Input/Output

JavaScript input and output
Java Script allows the user to input data to it, perform operations and generate output. These process can be realised using several methods; user prompts, form elements and via a ducument window.

JavaScript Prompts
There are three types of user prompts namely prompt, confirm and alert. Each of the prompts has its own unique purpose in JavaScript. Prompt: It is used for accepting data input from the user. The prompt dialogue input box is comprised of four(4) things: Title bar containing a title, Discriptive text, Data entry area and Buttons.



Title bar: Contains the title of the script. Descriptive text: This is a message for the user, describing the type of data expected from the user. Data entry area: This is where the data is entered by the user. It normally contains a blinking cursor whithin it. this is to indicate to the user where the data entry point/section is. Buttons: There are two types of buttons on the prompt dialogue box: OK and Cancel. When the OK button is pressed, it activates the sending of the value to the program and then unloads the dialogue box from the screen. The Cancel button discards the value and then unloads the dialogue box from the screen. Example: x=prompt("Enter value"); "

Alert: This is an output dialogue box that is mostly used to convey a warning message to the user. The allert message dialogue box has three sections: Title, Message and Button Title: It displays the title of the script. Message: It displays the message to the user. It is the most important section of the alert box. Ok Button: Clicking this buttob unloads the allert message box from the screen.