How to use Window Object Confirm in JavaScript
In this article I am going to explain about window object Confirm() Method.
JavaScript Window object Confirm() Method
JavaScript confirm() Method use for display confirmation window for user confirmation before any action. Confirmation dialog box return true or false at the behave of user.
Syntax
Example
<html>
<head>
<script type="text/javascript">
function myfun() {
var a;
var b = confirm("press button");
if (r == true) {
x = "Action has been done";
}
else {
x = "Action has not been done";
}
document.getElementById("txt").innerHTML = x;
}
</script>
</head>
<body>
<button onclick="myfun()">
click me</button>
<p id="txt">
</p>
</body>
</html>
|
Output
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here