MinsoftK

test for using tag

...@@ -14,6 +14,11 @@ function LinksSetColor(color){ ...@@ -14,6 +14,11 @@ function LinksSetColor(color){
14 i+=1; 14 i+=1;
15 } 15 }
16 } 16 }
17 +var Body={
18 + setColor:function(color){
19 +
20 + }
21 +}
17 function bodySetColor(color){ 22 function bodySetColor(color){
18 document.querySelector('body').style.color= color; 23 document.querySelector('body').style.color= color;
19 } 24 }
......
1 +var Links={
2 + SetColor:function(color){
3 + var alist=document.querySelectorAll('a');
4 + var i =0;
5 + while(i<alist.length)
6 + {
7 + alist[i].style.color=color;
8 + i+=1;
9 + }
10 + }
11 +
12 +}
13 +var Body = {
14 + SetColor:function(color){
15 + document.querySelector('body').style.color= color;
16 + },
17 + SetBackGruondColor:function(color){
18 + document.querySelector('body').style.backgroundColor= color;
19 + }
20 +}
21 +
22 +function nightDayHandler(self){
23 + if(self.value==='night')
24 + {
25 + Body.SetBackGruondColor('black')
26 + Body.SetColor('white');
27 + self.value= 'day';
28 +
29 + Links.SetColor('white');
30 +
31 + }else{
32 + Body.SetBackGruondColor('white')
33 + Body.SetColor('black');
34 + self.value= 'night';
35 +
36 + Links.SetColor('blue');
37 + }
38 + }
...@@ -20,11 +20,15 @@ ...@@ -20,11 +20,15 @@
20 </script> 20 </script>
21 21
22 <h2>iterate</h2> 22 <h2>iterate</h2>
23 - <script>
24 - for(var key in coworkers){
25 - document.write(key+' : ' +coworkers[key]+'<br>');
26 - }
27 - </script>
28 23
24 + <h2>property & method</h2>
25 + <script>
26 + coworker.showAll =function(){
27 + for(var key in this){
28 + document.write(key+' : ' +this[key]+'<br>');
29 + }
30 + }
31 + coworkers.showAll();
32 + </script>
29 </body> 33 </body>
30 </html> 34 </html>
......
...@@ -4,53 +4,12 @@ ...@@ -4,53 +4,12 @@
4 <title>KHU KHU Chat</title> 4 <title>KHU KHU Chat</title>
5 <meta charset="utf-8"> 5 <meta charset="utf-8">
6 <link rel="stylesheet" href="style.css"> 6 <link rel="stylesheet" href="style.css">
7 -<script> 7 +<script src="colors.js"></script>
8 -
9 - var Links={
10 - SetColor:function(color){
11 - var alist=document.querySelectorAll('a');
12 - var i =0;
13 - while(i<alist.length)
14 - {
15 - alist[i].style.color=color;
16 - i+=1;
17 - }
18 - }
19 -
20 - }
21 - var Body = {
22 - SetColor:function(color){
23 - document.querySelector('body').style.color= color;
24 - },
25 - SetBackGruondColor:function(color){
26 - document.querySelector('body').style.backgroundColor= color;
27 - }
28 - }
29 -
30 - function nightDayHandler(self){
31 - if(self.value==='night')
32 - {
33 - Body.SetBackGruondColor('black')
34 - Body.SetColor('white');
35 - self.value= 'day';
36 -
37 - Links.SetColor('powderblue');
38 -
39 - }else{
40 - Body.SetBackGruondColor('white')
41 - Body.SetColor('black');
42 - self.value= 'night';
43 -
44 - Links.SetColor('blue');
45 - }
46 - }
47 -</script>
48 </head> 8 </head>
49 <body> 9 <body>
50 <input id="night_day" type="button" value="night" onclick=" 10 <input id="night_day" type="button" value="night" onclick="
51 nightDayHandler(this); 11 nightDayHandler(this);
52 "> 12 ">
53 -
54 <!-- button2 making and using function --> 13 <!-- button2 making and using function -->
55 <input id="night_day" type="button" value="night" onclick=" 14 <input id="night_day" type="button" value="night" onclick="
56 nightDayHandler(this); 15 nightDayHandler(this);
......