var xmlHttp;
function srvTime(){
    if (window.XMLHttpRequest) {//분기하지 않으면 IE에서만 작동된다.
        xmlHttp = new XMLHttpRequest(); // IE 7.0 이상, 크롬, 파이어폭스 등
        xmlHttp.open('HEAD',window.location.href.toString(),false);
        xmlHttp.setRequestHeader("Content-Type", "text/html");
        xmlHttp.send('');
        return xmlHttp.getResponseHeader("Date");
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
        xmlHttp.open('HEAD',window.location.href.toString(),false);
        xmlHttp.setRequestHeader("Content-Type", "text/html");
        xmlHttp.send('');
        return xmlHttp.getResponseHeader("Date");
    }
}

     var st = srvTime();
     var date = new Date(st);
     var today = date.getFullYear() + addZero(date.getMonth()+1) + addZero(date.getDate());

 

      function addZero(n){
          return n < 10 ? "0" + n : n;
      }

 

by 노란날. 2013.04.30 17:45
| 1 2 3 4 5 6 7 8 ··· 82 |