Alert and Prompt Window in JavaScript
Free Web development courses with real-time projects Start Now!!
Program 1
<html> <head><title>Java Script Test Prgram</title> <script lang="javascript"> function display() { // alert("wel come to my page") var a; a=prompt("Enter Your Name Here...") document.write("<center>") document.write("<font color=green size=7>") document.write("My Name is: " +a) document.write("</font>") document.write("</center>") } </script> </head> <body> <form> <input type="button" value="Click here" onclick="display()"> </form> </body> </html>
Program 2
<html> <head><title>Java Script Test Prgram</title> <script lang="javascript"> function display() { for(i=1;i<=10;i++) document.write(i) // alert("wel come to my page") // var n,f=1; // n=prompt("Enter First Number..."); // if(n!=null && n!="") // { // n=parseInt(n); // while(n!=0) // { // f=f*n; // n--; // } // alert("Factorial is "+f); // } } </script> </head> <body> <form> <input type="button" value="Click here" onclick="display()"> </form> </body> </html>
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google