确认功能不起作用 [英] confirm function is not working
本文介绍了确认功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
*<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>*
我想知道是什么问题.它不起作用,但与 http://www.w3schools.com/js/中的相同js_popup.asp
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
推荐答案
- 您正在递归调用
confirm()
,它处于无限循环中 - 文档的开头和结尾处都有一个
*
- 正如肯尼贝克指出的那样,您正在覆盖
window.confirm
- 您在
< body>
中有一个悬挂端
</div>
- You are recursively calling
confirm()
and it's in an infinite loop - You have a
*
at the beginning and end of the document - As kennebec pointed out, you're overwriting
window.confirm
- You have a hanging end
</div>
in the<body>
<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>
这篇关于确认功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文