<script> var result = confirm("确定要这么做吗?"); if(result){//true alert('点了确定'); } else { //false alert('点了取消'); } </script>