[javascript] confirm & alert 생성 하기.

Web/JavaScript 2011. 9. 7. 17:12 Posted by Request
1. alert

alert("문구 쓰기");

onClick="alert('보여줄 문구 쓰기');"
onClick="javascript:alert('문구 쓰기');"


2.confirm

function cancle(){
    if(confirm("보여줄 문구")){
       //확인 버튼
        window.location.href="이동 할 경로";
    }else{
       window.location.href="이동할 경로";     // 취소 시 페이지 상태를 유지 할려면 경로에 # 만 쓰면된다.
    }
}