var isEventSupported = (function(){
var TAGNAMES = {
'select':'input','change':'input',
'submit':'form','reset':'form',
'error':'img','load':'img','abort':'img'
}
function isEventSupported(eventName) {
var el = document.createElement(TAGNAMES[eventName] || 'div');
eventName = 'on' + eventName;
var isSupported = (eventName in el);
if (!isSupported) {
el.setAttribute(eventName, 'return;');
isSupported = typeof el[eventName] == 'function';
}
el = null;
return isSupported;
}
return isEventSupported;
})();
사용법은 isEventSupported(event) 인데 on 빼고 입력하면 됩니다. 여부를 리턴하죠.
링크 #1은 원문이고, 링크 #2는 예제입니다.
요즘 쓸데없는일로 스트레스쌓여서 슬럼프상태입니다. 그렇다보니 이렇게 팁을 퍼오기만 하고.. 쩝.. 일단 충분한 안정이 필요한것같습니다..ㅠㅠ
var TAGNAMES = {
'select':'input','change':'input',
'submit':'form','reset':'form',
'error':'img','load':'img','abort':'img'
}
function isEventSupported(eventName) {
var el = document.createElement(TAGNAMES[eventName] || 'div');
eventName = 'on' + eventName;
var isSupported = (eventName in el);
if (!isSupported) {
el.setAttribute(eventName, 'return;');
isSupported = typeof el[eventName] == 'function';
}
el = null;
return isSupported;
}
return isEventSupported;
})();
사용법은 isEventSupported(event) 인데 on 빼고 입력하면 됩니다. 여부를 리턴하죠.
링크 #1은 원문이고, 링크 #2는 예제입니다.
요즘 쓸데없는일로 스트레스쌓여서 슬럼프상태입니다. 그렇다보니 이렇게 팁을 퍼오기만 하고.. 쩝.. 일단 충분한 안정이 필요한것같습니다..ㅠㅠ
게시글 목록
| 번호 | 제목 |
|---|---|
| 10762 |
jQuery
회사에 히스토리에 써먹을 만한 자료
8
|
| 10754 | |
| 10752 |
MySQL
고수님들 도와주세요!
1
|
| 10749 |
Mobile
json 파싱방법
2
|
| 10746 | |
| 10740 | |
| 10738 | |
| 10736 | |
| 10733 |
JavaScript
주민번호, 외국인번호 검사 스크립트
2
|
| 10731 |
Mobile
Base64.java 파일입니다.
1
|
| 10730 | |
| 10727 | |
| 10725 |
MySQL
Mysql Text필드
1
|
| 10721 | |
| 10719 |
Mobile
[안드로이드] 프리퍼런스 사용 방법
1
|
| 10718 | |
| 10712 | |
| 10711 |
Mobile
[ios]사진촬영후 이미지 편집 샘플입니다.
|
| 10710 |
JavaScript
Html , javascript , css 강좌 사이트 입니다.
|
| 10709 |
JavaScript
주민번호 자바스크립트 체크
|
| 10707 |
jQuery
안녕하세요 jquery에 대해 물어볼게있습니다
1
|
| 10706 | |
| 20108 | |
| 10705 |
Mobile
[안드로이드] 자신의 폰에 깔려있는 앱들 검색하기
|
| 10703 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기