0% found this document useful (0 votes)
66 views5 pages

Message and Conformations: 1.prompt

JavaScript provides three built-in windows - prompts, confirms, and alerts - that can be used to get input from or display messages to users. Prompts display text fields for user input, confirms show messages with OK and Cancel buttons, and alerts simply display messages that must be acknowledged with OK. JavaScript can also write messages to the browser status bar and use frames to structure multi-page websites into different interactive sections.

Uploaded by

rama584
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views5 pages

Message and Conformations: 1.prompt

JavaScript provides three built-in windows - prompts, confirms, and alerts - that can be used to get input from or display messages to users. Prompts display text fields for user input, confirms show messages with OK and Cancel buttons, and alerts simply display messages that must be acknowledged with OK. JavaScript can also write messages to the browser status bar and use frames to structure multi-page websites into different interactive sections.

Uploaded by

rama584
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

4.

Message and conformations:


JavaScript provides three built-in window types that can be used from application code.This are useful when user required input from the user.Javascript contain different windows .They are 1.Prompt. 2.Conform. 3.Alert. 1.Prompt: 1This command displays simple windows that contain a prompt and a text field in which the user can enter the data. 2. A prompt box is often used if you want the user to input a value before entering a page. 3.When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. 4.If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null. 5.The general syntax of the prompt is: Syntax: prompt("sometext","defaultvalue"); 6.The method has two parameters :A text string to be used as the prompt and a string to use default value.If u don want to display default value then simply use an empty string. Example program: <html> <head> <body> <script type="text/javascript"> var name=prompt("Please enter your name","reddy"); document.write("Hello " + name + "! How are you today?"); </script> </head> </body></html>

EXPLANATION: 1.In above example program will prompt the user for enter the text in to the text field. 2.The default value is reddy.

2.confirm(string).
1.It shows the windows containing a message and two buttons: ok and cancel. Ok: ok will let the action proceed. Cancel: cancel will abort any pending action. 2. A confirm box is often used if you want the user to verify or accept something. 3. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. 4.Syntax: confirm("sometext");

Example program conform method:


<html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Press a button!"); if (r==true) { alert("You pressed OK!"); } else { alert("You pressed Cancel!"); }}

</script> </head> <body> <input type="button" onclick="show_confirm()" value="Show a confirm box" /> </body> </html>

3.Alert (string) 1.it will display the text string and an ok button. 2.This may be used as a warning or to provide a information to the user. 3. An alert box is often used if you want to make sure information comes through to the user. 4.Syntax:alert(string) Example program for alert();
<html> <head> <script type="text/javascript"> alert("Hello! I am an alert box!"); </script> </head> <body> </body> </html>

5.THE STATUSBAR:
The status bar is the small message area you see at the bottom of the browser window. usually, we can see a web page symbol and the word "done". For Netscape users, you probably see "document : done". This area can actually be used to show a message. Click on these buttons and watch it change. A popular role of the status message is for links. As the visitor hovers their mouse over a link, a message can appear to help them understand where that link will go. This

helps when you are dealing with text links. JavaScript can be used to display messages in the status bar using window. status. For example, you can display a JavaScript status bar message whenever your users hover over your hyperlinks Syntax: window.status=streing; Example program for Status bar: <html> <body> <script type="text/javascript"> function statwords(message){ window.status = message; } </script> <center> <form> <input type="button" VALUE="Write a status bar message" OnClick="statwords('This is my

message');"> <input type="button" VALUE="Erase the status bar message" OnClick="statwords(' ');"> </form> </center> </body> </html> Explanation: The above is a simple FORM of 2 buttons. The JavaScript event OnClick activates the function called stat words and passes a text string to a variable called message. The function then activates the status bar area and inserts the text string. 6.FRAMES: 1.we can use frames as a site layout device.

2.once frames and JavaScript are combined the page can be have some interesting interactive aspects. 3.With the help of frames we can write program in one page and we can see output in other page. 4.The Frame object represents an HTML frame. 5.The <frame> tag defines one particular window (frame) within a frameset. 6.For each <frame> tag in an HTML document, a Frame object is created. i)FRAMESET: In JavaScript the whole page is built around a simple frameset. Generally the frame set is The Frameset object represents an HTML frameset. The HTML frameset element holds two or more frame elements. Each frame element holds a separate document. The HTML frameset element states only how many columns or rows there will be in the frameset.. Example program for Frameset: <html> <frameset id="main" rows="50%,50%"> <frame src="frame_rows.htm" /> <frame src="frame_a.htm" /> </frameset> </html>

You might also like