| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
- 백신
- .net
- Ajax
- 성공
- 게으름
- 실버라이트2
- 형태소분석기
- GTD
- 실버라이트
- 해킹
- 구글
- jQuery
- 개발자
- Sliverlight
- C#
- 암호화
- Web 2.0
- 전기차
- silverlight
- 자바스크립트
- ASP.NET
- MS
- 검색
- JavaScript
- GDI+
- COM+
- WEb 2.0 Expo
- hnd-7070
- XML
- 리팩토링
- Today
- Total
꿈으로 가는 작은 계단
Firefox용 innerText 본문
Firefox에는 innerHTML만 있고 innerText는 없읍니다.
다음과 같이하면 대강 비슷하게는 됩니다.
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
// IE에서는 innerText 된다.
sText = document.getElementbyId("idText").innerText;
// IE/FF공용 ( FF는 innerTextIE가 없다. )
sText = document.getElementbyId("idText").innerHTML;
sText = sText.replace(/(<br>)/ig," ");
sText = sText.replace(/(<[^>]+>)/g,"");
</SCRIPT>
출처 : phpschool
아래 내용은 덧글입니다. 읽으면서 따라 내려가면 재미가 있네요...마지막 부분에 제목에 정답이 있을지도..
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=54096&page=1
Code1 :
var node = document.getElementById('idText');
node.innerHTML = '';
node.appendChild(document.createTextNode('some text'));
아... 받아올때는...
IE 에서는 node.innerText;
FF 에서는 var itext = document.createRange().selectNodeContents(node).toString();
Code2 :
try {
HTMLElement.prototype.__defineGetter__("innerText", function() { return this.textContent; });
HTMLElement.prototype.__defineSetter__("innerText", function(txt) { this.textContent = txt; });
} catch(e) {
try {
HTMLElement.prototype.innerText getter = function() { return this.textContent; };
HTMLElement.prototype.innerText setter = function(txt) { this.textContent = txt; };
} catch(e) {}
}
Code3 :
if ( 파폭인가 ? ){
HTMLElement.prototype.__defineGetter__("innerText", function() { return this.textContent; });
HTMLElement.prototype.__defineSetter__("innerText", function(txt) { this.textContent = txt; });
}
이렇게 쓰시면 통합된 스크립팅을 하실 수 있습니다.
'소프트웨어 > JavaScript • Dhtml' 카테고리의 다른 글
| Prototype 1.5.0 커닝 페이퍼 (0) | 2007.05.29 |
|---|---|
| 자바스크립으로 플래쉬 메뉴처럼... (0) | 2007.05.26 |
| 라운드 테이블 | 라운드 박스 | 호의각도/굵기를 내맘대로... (2) | 2007.05.26 |
| Prototype 1.5.1 release candidate 2 (0) | 2007.04.25 |
| 스위칭 탭 & 탭 메뉴 (0) | 2007.04.24 |