xxxxxxxxxx
onclick="return confirm('Are you sure?')"
<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a>
xxxxxxxxxx
let text = "Press a button!\nEither OK or Cancel.";
if (confirm(text) == true) {
text = "You pressed OK!";
} else {
text = "You canceled!";
}
document.getElementById("demo").innerHTML = text;