logo

India's First Software Developer Community

Popup Box (Alert and Confirm Box)

Learn Popup Boxes of Javascript,
    
    There are three type of POPUP box in Javascript

    1) ALERT BOX
    2) CONFIRM BOX
    3) PROMPT Box

 


<!DOCTYPE html>
<html>
<head>
<title>Popup Box in Javascript | W3CodeIndia</title>
<script>
// Alert Box
function newfunction()
{    
    alert("I am in Alert Box.");
}

//Confirm Box
function newfunction1()
{
    var txt;
    if(confirm("Press Any Button !")== true)
    {
        txt="You Pressed OK !";
    }
    else
    {
    txt="You pressed Cancel !";
    }
    document.getElementById("demo").innerHTML=txt;
}
</script>
</head>
<body>
<center><h1>Popup Box In Javascript Part One</h1></center>
<center><p><button onClick="newfunction()"> Alert Box </button></p></center>

<center><p><button onClick="newfunction1()"> Confirm Box </button></p></center>
<center><p id="demo"></p></center>
</body>
</html>




Subscribe Us :

Chapters :-


Advertisement