The box below contains the HTML for the page you have chosen to edit. Add your own HTML to customize this page: <HTML> <HEAD> <TITLE>window.prompt() Method</TITLE> <SCRIPT LANGUAGE="JavaScript"> function database() { var howMany = prompt("Fill in name of employee.","") if (howMany != null && howMany != "") { alert("Looking for details of " + howMany) // for demo //statements that validate the entry and //actually populate the fields of the table } } </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function enjoying() { if (confirm("Are you sure wanna see this?")) { alert("I'm glad u are. Stick around!") // for demo purposes //statements that actually empty the fields } } </SCRIPT> </HEAD> <BODY background="notebookback.gif" text="black"><h2><center>LESSON 6</center> <center> DIALOG BOXES </Center></h2> <ul> <br> <table border=0> <td bgcolor=black align=center valign=top> <br><p> <br><p> <br><p> <a href=javaproject.html>HOME</a><br><p> <a href=lesson1.html>LESSON 1</a><p> <a href=lesson2.html>LESSON 2</a><p> <a href=lesson3.html>LESSON 3</a><p> <a href=lesson4.html>LESSON 4</a><p> <a href=lesson5.html>LESSON 5</a><p> <a href=lesson7.html>LESSON 7</a><p> <a href=lesson8.html>LESSON 8</a><p> <a href=lesson9.html>LESSON 9</a><p> <a href=lesson10.html>LESSON 10</a><p> </td> <td></td><td></td><td></td> <td align=left bgcolor=lightyellow> <p>Can you recall chapter one, which teaches how to make alert dialog boxes? Well this lesson will teach you some more dialog boxes - The 'Prompt Dialog Box" and the 'Confirm Dialog Box'. As the word 'Prompt' suggests, it prompts users to type in something specific.It is a very handy user input device.</p> <p>Let me give you an example.</P> <FORM> <!-- other statements that display and populate a large table --> <INPUT TYPE="button" NAME="fill" VALUE="Fill Name" onClick="database()"> </FORM> <p> As you can see here, after typing in something and clicking ok or pressing 'ENTER', an alert boxes pops up to tell you what its doing. But if you don't write anything in the box and press ok, it does nothing - the same thing that cancel does - nothing! There is a prewritten answer in this case - shown by the alert box - leaving the user to do nothing but press ok. </P> <BR> <p><A HREF="promptdialog.txt">View code for Prompt dialog box</A></P><BR><BR> <p> Now click on Reset and see what happens.....</P> <FORM> <!--other statements that display and populate large table --> <INPUT TYPE="button" NAME="clear" VALUE="Reset" Table" onClick="enjoying()"> </FORM><BR> <p> Now that was a 'Confirm Dialog Box'. Again a very useful input device. This is particularly helpful prior to a script performing actions that cannot be undone. For instance, many a times people accidently click a button that may quit a program. Its quite frustrating for that person to restart all over again - hence providing avenues to back out of such an operation before its executes. Then again it makes a lot of sense to have a confirm dialog box for operations that may reveal a user's identity or send form data to a server.</P> <BR> <A HREF="confirmdialog.txt">View Code for Confirm Dialog box</A> <p> Those were all the dialog boxes u're going to be seeing. Go ahead and use them. They're very impressive!</p> <A HREF= "lesson7.html">LESSON 7</A> </td> </table> </BODY> </HTML>
The box below contains the HTML for the page you have chosen to edit.
Add your own HTML to customize this page: