티스토리 뷰

프로그래밍/Javascript

팝업창 띄우기

안싱미 2016. 5. 3. 15:26
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<html>
   <head>
      <script type="text/javascript">
      
         function closure() {
            return function() {
               alert("안녕 클로저야")
            }();
         }
         
         function hello(message) {
            //alert(message + "라고 말했습니다.");
            window.opener.testAlert();
         }
         
         window.onunload = function() {
            window.opener.testAlert();
         };
         
         function changeData() {
            var text1 = document.getElementById("text1");
            text1.focus();
            text1.value = "안녕하세요!!!!!!!!";
         }
         
         window.onload = function() {
            // var p1 = $("#p1");
            var p1 = document.getElementById("p1");
            
            // p1.click(function() {...});
            p1.ondblclick = function() {
               alert("반갑습니다.");
            };
            
            p1.onclick = closure();
            
            p1.onmouseover = function(e) {
               //alert(e.pageX + " " + e.pageY);
               alert("마우스 안녕?");
            };
            
            p1.onmouseout = function(e) {
               alert("마우스 잘가?");
            }
            
            document.onmousewheel = function(e) {
               console.log(e);
            }
            alert("잘 돼용!")
         };
         
      </script>
      
   </head>
   <body>
      
      <input   type="button" id="clickButton" value="눌러보세요"  
            onclick="changeData();"/>
            
      <input    type="button" id="clickButton2" value="더블 클릭해보세요."  
            ondblclick="alert('안녕');"/>
 
      <div    id="div1"
            style="width: 150px; height: 150px; background-color:#000;"
            onclick="alert('안되는줄 알았지?');">
      </div>
      
      <div    id="div2"
            style="width: 150px; height: 150px; background-color:#000;"
            ondblclick="alert('안되는줄 알았지?');">
      </div>      
      
      <!-- href javascript 아무것도 하지마라-->
      <a href="javascript:void(0);" onclick="alert('^^');"> 클릭해보세요!!</a>
      
      <span   id="span1"
            onclick="hello('안녕?')">
            클릭!
      </span>
 
      <input   type="text" id="text1"
            onchange="alert('데이터가 변경되었습니다.')" 
            onfocus="alert('선택되었습니다.');" />
            
      <input   type="text" id="text2"
            onblur="alert('선택해제되었습니다.');"
            onfocus="alert('선택되었습니다.');" />
            
      <p id="p1"> onclick 속성을 사용하지 않았습니다~ </p>      
   </body>
</html>
cs


실행화면




'프로그래밍 > Javascript' 카테고리의 다른 글

NotePad++ 로 자동완성 구현하기  (0) 2016.05.03
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함