사용자 도구

사이트 도구


javascript:commonfunctions

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
javascript:commonfunctions [2012/06/25 18:11]
kwon37xi 새로 만듦
javascript:commonfunctions [2012/06/28 16:34] (현재)
kwon37xi
줄 2: 줄 2:
 ===== Escape HTML ===== ===== Escape HTML =====
 <code javascript> <code javascript>
-function escapeHtmlEntities (str) { +function escapeHtml(str) { 
-  if (jQuery !== undefined) { +  if (str == null) { 
-    // Create an empty div to use as a container, +    return str;
-    // then put the raw text in and get the HTML +
-    // equivalent out. +
-    return jQuery('<div/>').text(str).html();+
   }   }
- 
-  // No jQuery, so use string replace. 
   return str   return str
     .replace(/&/g, '&amp;')     .replace(/&/g, '&amp;')
줄 20: 줄 15:
 </code> </code>
  
 +===== URL QUery String ===== 
 +<code javascript> 
 +// location.search : ?를 포함한 쿼리 스트링 전체를 리턴한다. 
 +// 따라서 아래 코드로 ?를 제외한 쿼리 스트링을 확보할 수 있다. 
 +var query_string = unescape(location.search.substr(1)); 
 +</code>
  
javascript/commonfunctions.1340615465.txt.gz · 마지막으로 수정됨: 2012/06/25 18:11 저자 kwon37xi