XMLHttpRequest 객체 const xhr = new XMLHttpRequest(); const method = "GET"; const url = ""; xhr.open(method, url); /* open() 함수를 통해 요청을 초기화한다. onreadystatechange 이벤트를 이용해 요청에 대한 응답 결과를 처리합니다. onreadystatechange 프로퍼티는 XMLHttpRequest 객체의 readyState 프로퍼티 값이 변할 때마다 자동으로 호출되는 함수를 설정합니다. */ xhr.onreadystatechange = function (event) { /* onreadystatechange 프로퍼티(속성)에 콜백함수 설정 응답이 와서 상태값이 변하면 호출된다. */ const..
document .querySelector 클릭 function myFunc(){ var boxList=document.querySelectorAll("#wrap>#box") //#wrap하위의 #box모두 접근 boxList[0].innerText="변경111" boxList[1].innerText="변경222" } function myFunc2(){ var boxList=document.querySelectorAll("#wrap>#box") //#wrap하위의 #box모두 접근 alert(boxList[0].innerText) alert(boxList[1].innerText) } wrap 하위 box로 접근도 가능하고, 배열 안에 넣어서도 사용가능하다. .getElementById 클릭 ID에 의한 ..
객체생성 Data 객체 var date = new Date() //Date객체 생성 //new - 메모리 생성 연산자 var year=date.getFullYear()//년 var month=date.getMonth()+1//월 var day = date.getDate()//일 var hour = date.getHours()//시 var min = date.getMinutes()//분 var sec = date.getSeconds()//초 if(month < 10){ month = "0"+month } if(day < 10){ day = "0"+day } var format = year+"-"+month+"-"+day+" " format = format + (hour+":"+min+":"+sec) doc..
function(함수) function hello(){//hello함수 정의 alert("hello!") } hello()//hello함수 호출 //--------------------------------------------------- function hello(n){//매개변수,파라미터 alert("hello:"+n);//hello:3 } hello(3)//함수 호출(function call) //hello함수를 호출하면서 입력으로 3전달 //매개변수=매개체변수 //매개체=둘사이를 연결하는 ~어떤것 //--------------------------------------------------- function add(n1,n2){//매개변수 2개 설정 return n1+n2;//더한값 반환 //함..