별의 공부 블로그 🧑🏻‍💻
728x90
728x170
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!-- 폼 요소 선택자 예제 -->
<form method="post" action="#" name="log_f">
    <fieldset>
        <legend>회원 로그인</legend>
        <p>
            <label for="my_id">아이디</label>
            <input type="text" name="user_id" id="my_id" />
            <label for="my_pw">비밀번호</label>
            <input type="password" name="user_pw" id="my_pw" />
        </p>
        <input type="submit" value="login" />
    </fieldset>
</form>
 
 
<script type="text/javascript">
    document.f1.onsubmit=function(){
        var pw1=document.f1.user_pw1;
        var pw2=document.f1.user_pw2;
 
        pw2.value=pw1.value;
        pw2.disabled=true;
        return false;
    }
 
    document.f2.allChk.onclick=function(){
        if(this.checked) {
            document.f2.subject1.checked=true;
            document.f2.subject2.checked=true;
            document.f2.subject3.checked=true;
        }
        else {
            document.f2.subject1.checked=false;
            document.f2.subject2.checked=false;
            document.f2.subject3.checked=false;   
        }
    }
 
    document.f2.onsubmit=function(){
        var act=document.f2.accept;
        if(act.checked==false) {
            alert("약관 동의해야 합니다.");
            act.focus();
            return false;
        }
    }
</script>
cs

 

소스 출처 : Do It! 자바스크립트+제이쿼리 입문 (정인용 지음, 이지스퍼블리싱)

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖