Javascript/confirm

解説 "OK"と"キャンセル"のついたダイアログボックス
sample1
sample1code
var sample1Btn = document.getElementById("sample1Btn");
sample1Btn.onclick = function(){
  if(window.confirm("ページを開きますか?") == false){
  	location.href = "http://arise.work";
  }
}
	
sample2
sample2code
var sample2Btn = document.getElementById("sample2Btn");
sample2Btn.onclick = function(){
  if(confirm("本当にダウンロードしますか?")){
    console.log("Downloading...");
  } else {
    console.log("Not Download");
  }
}