0
나누기 반환합니다. 그러나 어떤 이유로 원본 텍스트에 줄 바꿈 문자가 없더라도 선택한 html에 \ r \ n이 포함되어 있습니다. 왜 이런 일이 일어나는 지 아는 사람이 있습니까?IE TextRange.HtmlText 예기치 않은 라인이 나는 다음과 같은 코드를 빈 Asp.Net 프로젝트에서
대신 텍스트 속성을 사용하면 동일한 동작이 발생하지 않습니다.
<script type="text/javascript">
function OkClick() {
var TextRange = document.selection.createRange();
var SelectedText = TextRange.htmlText;
}
</script>
<div>
This is a test with a long line of text on a single line with no line breaks.Why is there a line break returned from htmlText on the TextRange object
</div>
<button onclick="OkClick()">OK</button>
내 SelectedText 변수에 할당됩니다 다음 당신이 단어 뒤에 줄 바꿈이 볼 수 있듯이 "왜"
This is a test with a long line of text on a single line with no line breaks.Why \r\nis there a line break returned from htmlText on the TextRange object
알아요.하지만 문제의 원인을 파악하고 싶습니다. – TGH