반응형

자바스크립트로 텍스트를 출력할 수 있다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
<!DOCTYPE html>
 
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <script>
            document.writeln("hello");
            //document 객체에 hello라고 보여준다
        </script>
    </body>
</html>
 
cs





function을 이용해서 버튼 클릭시 뒤로가게하는 법

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
 
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <script>
            function duck(){
                history.go(-1//한단계 뒤로 
            }
        </script>
        <form>
            <input type="button" value="클릭!" onclick="duck()">
        </form>
    </body>
</html>
 
 
cs







버튼 클릭시 창 띄워주게 하는법 



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
 
<!DOCTYPE html>
 
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <script>
            function duck(turtle){
                if(turtle.kebi[0].selected)
                alert("첫번째")
                if(turtle.kebi[1].selected)
                alert("두번째")
                if(turtle.kebi[2].selected)
                alert("세번째")
                if(turtle.kebi[3].selected)
                alert("네번째")
            }
        </script>
        <form>
            <input type="button" value="클릭!" onclick="duck(this.form)">
            <select name="kebi">
                <option selected>안녕..</option>
                <option>둘리</option>
                <option>석시</option>
                <option>넉삼</option>
            </select>
        </form>
    </body>
</html>
 
cs






반응형
Posted by 제3인생자
l