Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  177] [ 2]  / answers: 1 / hits: 33759  / 13 Years ago, fri, october 21, 2011, 12:00:00
*<html>
<head>
<title>practise</title>
<script type=text/javascript>
function confirm() {
var r = confirm(Press the button);
if (r == true) {
alert(You are right);
} else {
alert(You are wrong);
}
}

</script>
</head>

<body>
<input type=button name=submit value=showtime onclick=confirm()/>
</div>
</body>
</html>*


I want to know what's the problem. It is not working but it is the same as in http://www.w3schools.com/js/js_popup.asp


More From » html

 Answers
29

  1. You are recursively calling confirm() and it's in an infinite loop

  2. You have a * at the beginning and end of the document

  3. As kennebec pointed out, you're overwriting window.confirm

  4. You have a hanging end </div> in the <body>






http://jsfiddle.net/cvyyL/



<html>
<head>
<title>practise</title>
<script type=text/javascript>
function show_confirm() {
var r = confirm(Press the button);
if (r == true) {
alert(You are right);
} else {
alert(You are wrong);
}
}
</script>
</head>
<body>
<input type=button name=submit value=showtime onclick=show_confirm()/>
</body>
</html>

[#89507] Wednesday, October 19, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jamilab

Total Points: 687
Total Questions: 88
Total Answers: 86

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
jamilab questions
;