문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 마지막 판 양쪽 다음 판 | ||
javascript:commonfunctions [2012/06/25 18:11] kwon37xi 새로 만듦 |
javascript:commonfunctions [2012/06/27 16:57] kwon37xi |
||
---|---|---|---|
줄 2: | 줄 2: | ||
===== Escape HTML ===== | ===== Escape HTML ===== | ||
<code javascript> | <code javascript> | ||
- | function | + | function |
- | 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 | + | |
} | } | ||
- | |||
- | // No jQuery, so use string replace. | ||
return str | return str | ||
.replace(/&/ | .replace(/&/ |