javascript popup code example

Example 1: simple alert program in javascript

alert("this is the alert")

Example 2: javascript alert

alert("string");

Example 3: javascript pop

var cars = ['mazda', 'honda', 'tesla'];
var telsa=cars.pop(); //cars is now just mazda,honda

Example 4: popup JavaScript code

document.getElementById("open-popup-btn").addEventListener("click",function(){
  document.getElementsByClassName("popup")[0].classList.add("active");
});
 
document.getElementById("dismiss-popup-btn").addEventListener("click",function(){
  document.getElementsByClassName("popup")[0].classList.remove("active");
});

Example 5: how to create pop message in simple html form

<html>
<head>
<title>
</title>

<style>
table
{
color:white;
border-radius:20px;
}

#button
{
background-color:green;
color:white;
height:32px;
width:85px;
border-radius:25px;
}

body
{
background:linear-gradient(red,blue);
}
</style>
   




</head>

<body>
<br><br><br><br><br><br><br>

<form>

<table border="0" bgcolor="black" align="center" cellspacing="20">
<tr>
<td>First Name</td>
<td><input type="text" placeholder="First Name" required  value = "" maxlength = "10"></td>

</tr>

<tr>
<td>Last Name</td>
<td><input type="text" placeholder="Last Name" required  value = "" maxlength = "10"></td>
</tr>

<tr>
<td>Email Address</td>
<td><input type="text" placeholder="Email Address" required  value = "" maxlength = "27"></td>
</tr>

<tr>
<td>Password</td>
<td><input type="password" placeholder="Password" required   value = "" maxlength = "14"></td>
</tr>

<tr>
<td>Confirm Password</td>
<td><input type="password" placeholder="Confirm password" required value = "" maxlength = "14"></td>
</tr>

<tr>
<td>Gender</td>  
<td>
<input type="radio" name="r1" required>Male
<input type="radio" name="r1" required>Female
</td>
</tr>

<tr>
<td colspan="2" align="center"><a href ="login.html"><input type="submit" id="button"></a></td>
</tr>


</form>

</table>
</body>
</html>