1.A prompt box is often used if you want the user to input a value before entering a page.
2.When a prompt box pop-up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.
3.In this program we want to print the table of a given number by using prompt box and if else condition .
FOR EXAMPLE:-
<html> <body> <center> <script> var n=prompt("Enter any number which table you want:"); </script> <h1> Table of : <script>document.write(n);</script> <script> document.write("<table border=5 cellpadding=10>"); document.write("<tr>"); document.write("<td>"+"Sr.No."+"</td>"); document.write("<td>"+"n * i"+"</td>"); document.write("<td>"+"="+"</td>"); document.write("<td>"+"result"+"</td>"); document.write("</tr>");for(var i=1;i<=10;i++) { document.write("<tr>"); document.write("<td>"+i+"</td>"); document.write("<td>"+n+" * "+i+"</td>"); document.write("<td>"+"="+"</td>"); document.write("<td>"+n*i+"</td>"); document.write("</tr>");} document.write("</table>"); </script> </center> </body> </html>