logo

India's First Software Developer Community

Popup Box (Prompt Box)

Learn 3 rd Popup Box of Javascript,
    
    In last video We learn about alert and confirm popup box
    Now Its Time to learn About Third Type Popup Box

    3) PROMPT BOX    

     Prompt Box Plays very Important Role To get Information From User


<!DOCTYPE html>
<html>
<head>
<title>Popup Box in Javascript | W3CodeIndia</title>
<script>
function newfunction()
{    
    var txt;
    var person=prompt("Please Enter Your Name :", "W3CodeIndia");
    
    if(person==null || person=="")
    {
        txt="User Cancelled the Prompt.";
    }
    else
    {
        txt="hello"+person+", Welcome To W3CodeIndia !";
    }
    document.getElementById("demo").innerHTML=txt;
}
</script>
</head>
<body>
<center><h1>Popup Box In Javascript Part Two</h1></center>
<center><button onClick="newfunction()">Prompt Box</button></center>
<center><p id="demo"></p></center>
</center>
</body>
</html>




Subscribe Us :

Chapters :-


Advertisement