HTML Compiler Online
Javascript Online Compiler
index.html
Change Theme
Compress code
Format code
Download Code
Clear Code
Copy Code!
RunĀ
ctrl+s or click
Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Javascript - Popup Confirm</title> </head> <body> <h2>Using "confirm()" method to create confirm box.</h2> <p>You can pass direct string or string variable in the confirm method to display message.</p> <button onclick="deleteFile()">Delete File</button> <script> function deleteFile() { var del = confirm("Do you want to delete the file?"); if (del) { document.write("File Deleted!"); } else { document.write("File Not Deleted!"); } } </script> </body> </html>
RunĀ