• 지역별 시간계산 구조
  1. DB에 저장된 시간(한국시간)을 GMT 시간 A로 변환
  2. 사용자의 기기브라우저 시간과 GMT 시간차이 계산해서 B를 가져옴 (ex: America/New_York : -04:00)
  3. A + B

ex) 
[DB시간(한국)]              -> GMT+0:00 변환              -> 현지시간(ex:America/New_York)과 GMT+0:00차이 시간(-4:00)을 더함]
[2015-03-12 08:08:42] -> [2015-03-11 23:08:42] -> [2015-03-11 19:08:42]



결과 (ex: 미국 동부 표준시)


1
2
3
4
5
6
7
8
9
10
function ChkRegNum(val) { 
    if (event.keyCode < 48 || event.keyCode > 57) { 
        if (event.keyCode != 46) { 
            alert('숫자만 입력!'); return false
        } else { 
            return true
        } 
    } 
    return true
}
cs


a태그에 history.back()을 설정할때 onclick에 설정하는 경우 작동하지 않는 경우가 발생할 수 있음. 그래서 href에 history.back()을 설정하면 잘 작동 됨.

1
<a href="javascript:window.history.back();">BtnBack</a>
cs


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
//trident
//ie7 : null, ie8 : 4.0, ie9 : 5.0, ie10 : 6.0, ie11 : 7.0
var trident = navigator.userAgent.match(/Trident\/(\d.\d)/i); 
 
//msie
var rv = -1;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if(re.exec(navigator.userAgent) != null) rv = parseFloat(RegExp.$1);
 
if( rv <= 7 ) //msie check (ie7~ie10 : 7~10, ie11 : -1)
{
     if(trident != null// trident check (ie8~11 : 4.0~7.0, ie7 : null)
     {
          if(trident[1== "7.0" && rv == 7// trident = ie11 && msie = ie7
          {
               alert("IE11 호환성체크");
          }
               else if(trident[1!= "7.0"// trident = ie8,9,10 && msie = ie7
          {
               alert("IE8,9,10 호환성체크");
          }
     }
     else // ie7 || other browser
     {
          if(navigator.appName == 'Microsoft Internet Explorer'//ie7
          {
               alert("IE 7이하");
          }
     }
}
 
cs


+ Recent posts