티스토리 뷰
Javascript 전통적 방식
function loadScript(url) { var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = url; headID.appendChild(newScript); } window.load = function() { loadScript('/path/ex.js'); }
jQuery 방식
$(function() { $('head').append( $(document.createElement('script')).attr({ 'type': 'text/javascript', 'src' : url }) ); });
추가: jQuery 방식으로 CSS Link 삽입도 동일
$(function() { $('head').append( $(document.createElement('link')).attr({ 'type': 'text/css', 'rel' : 'stylesheet', 'href' : url }) ); });
'웹프로그래밍 > js' 카테고리의 다른 글
Javascript libraries CDN (0) | 2013.06.21 |
---|---|
Wysiwyg CKEditor IE 9 이상에서 iframe 액세스 오류 (0) | 2013.03.08 |
Spac Editor IE에서 이미지 삽입시 커서위치 상실 문제 패치 (0) | 2012.05.23 |
jQuery.text() 하면 newline 날아가는것 방지 (0) | 2012.04.06 |
IE 8 이하에서 window.opener null undefined 오류시 (0) | 2012.03.13 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- centos
- 한글
- Mac
- nginx
- Debug
- Docker
- Prototype
- mssql
- 워드프레스
- nodejs
- IOS
- IE
- Wordpress
- iphone
- JQuery
- JSON
- javascript
- 안드로이드
- Android
- Linux
- laravel
- CSS
- macos
- git
- ASP
- PHP
- classic asp
- iis
- sencha touch
- API
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함