아오.. 한문이 죄다 깨져서... 수동으로 다 작업했다..

 

jquery.datepick-ko.js

 

jquery.datepick-tw.js

 

작업할때 참고한 사이트는 텍스트를 넣으면 유니코드 및 html 코드로 변환해주는 사이트이다..

 

http://unicode-table.com/en/

 

 

 

/* Chinese initialisation for the jQuery UI date picker plugin. */
/* Written by Ressol (ressol@gmail.com). */
jQuery(function($){
 $.datepick.regional['zh-TW'] = {
  closeText: '關閉',
  prevText: '<上月',
  nextText: '下月>',
  currentText: '今天',
  monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
  monthNamesShort: ['一','二','三','四','五','六','七','八','九','十','十一','十二'],
  dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
  dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
  dayNamesMin: ['日','一','二','三','四','五','六'],
  weekHeader: '周',
  dateFormat: 'yy/mm/dd',
  firstDay: 1,
  isRTL: false,
  showMonthAfterYear: true,
  yearSuffix: '年'};
 $.datepick.setDefaults($.datepick.regional['zh-TW']);  
});

 

'Web > JQuery' 카테고리의 다른 글

정규 표현식  (0) 2014.12.18
checkbox checked 설정  (0) 2014.10.17
JavaScript Class 상속  (0) 2014.05.21
Javascript override 방법  (0) 2014.05.21
jQuery.ajax() 사용시 중복호출 방지하는 방법  (0) 2014.05.21

상속 방법.

function MyParent(){ }

function MyClassA(){}

MyClassA.prototype = new MyParent ()

constructor를 설정하는 이유는?

MyClassA.prototype = new MyParent();

/* 아래 구문이 실행되기 전까지의 MyClassA.prototype.constructor = MyParent임.

constructor용도는 객체의 타입을 구분하기 위해서 사용됨.

*/
MyClassA.prototype.constructor = MyClassA;

 

'Web > JQuery' 카테고리의 다른 글

checkbox checked 설정  (0) 2014.10.17
Datepicker 대만 번체 zh-TW 번역자료  (0) 2014.07.28
Javascript override 방법  (0) 2014.05.21
jQuery.ajax() 사용시 중복호출 방지하는 방법  (0) 2014.05.21
[IE9 짜증남] IE 버전 체크  (0) 2014.05.21

override 방법

반드시 call(this)를 처럼 해야 됨.

그렇지 않은 경우, Parent의 private메소드를 호출하지 못하게 됨.

MyClassA.prototype.test4 = function() {
alert("MyClassA.prototype.test4" );
MyParent.prototype.test4.call(this);
}

---------------------------------------------------------------------------

예제)

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>무제 문서</title>
<script language="javascript">
function MyParent(nWidth, nHeight)
{
// private 변수 생성.
var width = nWidth;
var height =nHeight;

// 읽기전용 메소드 생성.
this.getWidth = function() {return this.width;}
this.getHeight = function() {return this.height;}
}

// 인스턴스 메소드.
MyParent.prototype.test1 = function()
{
alert("MyParent.prototype.test1 ");
}
// 인스턴스 메소드에서 읽기전용 호출 테스트.
MyParent.prototype.test2 =function ()
{
alert("MyParent.prototype.test2() getWidth = "+this.getWidth());
}

// 인스턴스 메소드에서 읽기전용 호출 테스트.
MyParent.prototype.test3 =function ()
{
alert("MyParent.prototype.test3() getHeight = "+this.getHeight());
}

MyParent.prototype.test4=function()
{
alert("MyParent.prototype.test4");
}

MyParent.prototype.name ="ddan";






function MyClassA(nValue)
{
this.superClass(10,10);
// private 프로퍼티 생성.
this.value = nValue;
}
MyClassA.prototype = new MyParent();
MyClassA.prototype.constructor = MyClassA;
MyClassA.prototype.superClass = MyParent;

// override
MyClassA.prototype.test2 =function()
{
alert("MyClassA.prototype.test2 " );
MyParent.prototype.test2.call(this);
}

// override
MyClassA.prototype.test4 =function()
{
alert("MyClassA.prototype.test4" );
MyParent.prototype.test4.call(this);
}


function on_Load()
{

var objClassA1 = new MyClassA(40);

objClassA1.test1();
// override 한 메소드 호출.
objClassA1.test2();
objClassA1.test3();
// override 한 메소드 호출.
objClassA1.test4();
}


</script>
</head>
<body onLoad="on_Load()">
</body>
</html>

 

'Web > JQuery' 카테고리의 다른 글

checkbox checked 설정  (0) 2014.10.17
Datepicker 대만 번체 zh-TW 번역자료  (0) 2014.07.28
JavaScript Class 상속  (0) 2014.05.21
jQuery.ajax() 사용시 중복호출 방지하는 방법  (0) 2014.05.21
[IE9 짜증남] IE 버전 체크  (0) 2014.05.21

jQuery.ajax() 사용시 중복호출 방지하는 방법

jQuery.ajax() 함수를 버튼 이벤트 같은 곳에 걸어두었을 경우 버튼을 여러번 클릭시 request 요청이 여러번 날아가서 오동작을 일으키는 경우가 있다.

이 때 아래와 같은 방법들로 해결할 수 있다.

1. jQuery.ajax() 세팅 옵션에 async: false 추가하는 방법

jQuery.ajax() 는 default 세팅 값이 true 로 되어 있어 요청을 비동기로 처리하게 되는데 async: false 옵션을 추가하면 동기로 처리하게 된다.

동기로 처리하게되면 아까 위와 같은 상황에서 버튼을 눌러 request 요청을 날렸을 때 response 요청이 올 때까지 다른 request 요청은 받지 않게 되어 중복호출을 방지한다.

 

 

 

2. 버튼에 클릭 이벤트를 jQuery.bind(), jQuery.unbind() 로 처리하는 방법

아래와 같이 jQuery.ready() 에 클릭 이벤트를 bind 시켜놓고, 한 번 클릭시 클릭 이벤트를 unbind 시켜 ajax 요청이 끝나면 다시 bind 시키는 방법이다.

 
     $(document).ready(function() {
           $('#foo').bind('click', function() {
                 doSomething();  
           });
           var doSomething = function(){
           $('#foo').unbind('click');
           $.ajax({ 
                         type: "POST",
                         url: "some.do"
            }).done(function() {
                         $('#foo').bind('click', function() {
                                 doSomething();
                     });  
             });
}
 
 
3. jQuery Block UI Plugin을 사용하는 방법

플러그인을 사용하는 방법으로 위 플러그인을 사용하게 되면 요청이 들어왔을 때 Please wait… 와 같은 Progress 메세지를 띄우면서 페이지에서 다른 이벤트를 막아버린다.

띄울 메세지를 css를 사용하여 커스텀으로 작성할 수도 있다.

 

 

 

'Web > JQuery' 카테고리의 다른 글

checkbox checked 설정  (0) 2014.10.17
Datepicker 대만 번체 zh-TW 번역자료  (0) 2014.07.28
JavaScript Class 상속  (0) 2014.05.21
Javascript override 방법  (0) 2014.05.21
[IE9 짜증남] IE 버전 체크  (0) 2014.05.21

웹 서버나 웹 페이지는 인터넷 브라우저로부터 종류와 버전 등의 정보를 받아서 각 브라우저와 버전에 맞는 페이지를 보여주게 합니다. 이 때 브라우저에서 제공하는 정보를 UA(User Agent) string이라고 합니다.
예를 들어 IE8까지는 “Mozilla/4”였던 UA String 값이 IE9에서는 “Mozilla/5”로 변경되었으므로
단순히 UA String 값이 ‘Mozilla/5’ 인지를 비교하여 Internet Explorer와 타 브라우저를 판단하여서는 안됩니다.
또한 “MSIE 9.0” 값을 얻어서 IE의 버전이 “9”임을 인식할 수 있습니다.


function getInternetExplorerVersion() {
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat(RegExp.$1);
}
return rv;
}


function checkVersion() {
var ver = getInternetExplorerVersion();
if (ver > -1)
msg = "You are using Internet Explorer " + ver;
else
msg = "You are not using Internet Explorer";
alert(msg);
}

 

'Web > JQuery' 카테고리의 다른 글

checkbox checked 설정  (0) 2014.10.17
Datepicker 대만 번체 zh-TW 번역자료  (0) 2014.07.28
JavaScript Class 상속  (0) 2014.05.21
Javascript override 방법  (0) 2014.05.21
jQuery.ajax() 사용시 중복호출 방지하는 방법  (0) 2014.05.21

+ Recent posts