var returned = window.confirm("请选择一个按钮单击!");if(returned){ window.alert("您单击了“确定”按钮!");}else{ window.alert("您单击了“取消”按钮!");} 如图: