-
Notifications
You must be signed in to change notification settings - Fork 0
/
ad.js
23 lines (19 loc) · 799 Bytes
/
ad.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Get a random number between 0 and 1
const randomNumber = Math.random();
// If the random number is greater than 0.5, show the popup
if (randomNumber > 0.5) {
// Get the popup and close button elements
const popup = document.getElementById("popup");
const closeBtn = document.getElementById("close-popup");
// Show the popup
popup.style.display = "block";
// Add an event listener to the close button to hide the popup when clicked
closeBtn.addEventListener("click", function() {
popup.style.display = "none";
});
}
// Get the button element and add an event listener to show the popup when clicked
const showBtn = document.getElementById("show-popup");
showBtn.addEventListener("click", function() {
// Get the code to show the popup here
});