confirm用法实例详解

版权声明:feixie https://blog.csdn.net/qq_36850813/article/details/79950099
<script>
    $(function() {
        $("#logout_btn").click(function() {
           var r= window.confirm('你确认退出吗?');
            if (r){
              window.location.href = "${pageContext.request.contextPath}/login.action";
            }else {
            }
        });

    });
</script>
<a href="javascript:;" id="logout_btn" title="Exit"><span>退出</span></a></div>
<html>
<head>
<script type="text/javascript">
function show_confirm(){
var r=confirm("Press a button!");
if (r==true){
  alert("You pressed OK!");
  }else{
  alert("You pressed Cancel!");
  }
}
</script>
</head>
<body>


<input type="button" onclick="show_confirm()" value="Show a confirm box" />


</body>
</html>

阅读更多

没有更多推荐了,返回首页