Message and Conformations: 1.prompt
Message and Conformations: 1.prompt
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");
</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>