開啟附有確認鈕的視窗
window.confirm 可開啟附有確認鈕的視窗
程式碼如下:
<script>
function Event1(){
if (window.confirm("Dialog with Yes/No buttons.")){
window.alert("You press Yes");
} else {
window.alert("You press No");
};
}
</script>
<input type="button" value="Press to confirm dialog" onclick="Event1()">
執行結果