SOURCE

console 命令行工具 X clear

                    
>
console
function show_confirm(){
    var tf=confirm("请选择按钮");
    if (tf==true){alert("您按了确定按钮");}
    else {alert("您按了取消按钮")}
}
<html>
    <head>
        <title>确认框</title>
    </head>
    <body>
    <form action="">
        <input type="button" onclick="show_confirm()"value="显示确认框">
    </form>
</body>
</html>
div{
    background-color: red
}