웹찢남

JAVASCRIPT 정리 본문

FRONT_END/이론 정리

JAVASCRIPT 정리

harry595 2020. 12. 8. 20:33

Event – onclick=”nightDayHandler(this);”,onchange,onkeykown

 

Datatype -  number

                String – x.length / x.toUpperCase() / x.indexOf(y) / x.trim() / x.replace(‘a’,’b’)

 

Function nightDayHandler(self){

  Var target= Document.querySelector(‘body’).

  Target.style.backgroundColor=’white’;

  If(target.dataset.mode===’day’){

    self.value=’day’;

  }else{

    self.value=’night’;}

    Var links=document.querySelectorAll(‘a’); -----------------

    Var i=0;                          

    While(i<links.length){

      Links[i].style.color=’powderblue’; 이 코드는 $(‘a’).css(‘color’,color);와 같음

      I=i+1;}

    }                                                     -----------------

Document.write(‘<li>1</li>’);  function 내에서는 self 인자를 넘길때는 this 사용

Var coworkers={“program”:”egoing”,”designer”:”latz”}

Document.write(“program”:coworkers.program+”<br>”);

Coworkers.bookkeeper=”duru”; coworkers[“data”]=”taeho”l

Coworkers[“bookkeeper”]

For (var key in coworkers) {
           document.write(key+coworkers[key]’<br>’)

}

Coworkers.showall = function(){

           For(var key in this){

                     Document.write(key+’:’+this[key]+’<br>’);

           }

}

Var body={

setColor:function(color){

        document.querySelector(‘body’).style.color=color;

}

}

-> Body.setColor로 사용 가능

'FRONT_END > 이론 정리' 카테고리의 다른 글

CSS 정리  (0) 2020.12.08
HTML 정리  (0) 2020.12.08
Comments