confirm
- confirm
<h2>Before</h2>
<script>
if (confirm("Shall I print Hello World?")) {
document.write("Hello World");
} else {
document.write("OK, I won't print it.");
}
</script>
<h2>After</h2>
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
<h2>Before</h2>
<script>
if (confirm("Shall I print Hello World?")) {
document.write("Hello World");
} else {
document.write("OK, I won't print it.");
}
</script>
<h2>After</h2>