자바 스크립트에서 줄 바꿈을 넣으려고합니다. <br/>, \n and %0D%0A
을 사용했지만 아무 일도 없었습니다.자바 스크립트에서 줄 바꿈을 넣는 방법?
This is dummy text.
It will blink and then show.
어떤 제안 :이 원하는
var textpara = 'This is dummy text. It will blink and then show.';
: 여기
내 코드?자바 스크립트에서 줄 바꿈을 넣으려고합니다. <br/>, \n and %0D%0A
을 사용했지만 아무 일도 없었습니다.자바 스크립트에서 줄 바꿈을 넣는 방법?
This is dummy text.
It will blink and then show.
어떤 제안 :이 원하는
var textpara = 'This is dummy text. It will blink and then show.';
: 여기
내 코드?콘솔의 텍스트를 표시 할 경우에는 백 슬래시 - 개행 트릭을 사용할 수 있습니다 :이 같은 줄 바꿈 추가, 또는
var textpara = 'This is dummy text. \
It will blink and then show.';
console.log(textpara);
을 :
var textpara = "This is dummy text. \nIt will blink and then show.";
console.log(textpara);
가 추가 "를 \ n을을 "일을해야한다.
이 시도 :
자바 스크립트 : 브라우저의 URL 표시 줄에
var textpara = "This is dummy text." + "\n" + "It will blink and then show.";
alert(textpara);
.
나는 그것을 테스트하고 그것을
이 시도 작동합니다
<script lang="JavaScript" >
var textpara = 'This is dummy text. <br/>It will blink and then show.';
document.write(textpara);
</script>
이 너무 작동합니다.
출력 :
This is dummy text.
It will blink and then show.
가 어떻게 표시 또는 문자열을 사용하고 있습니까? –
페이지, 콘솔 또는 경고 상자에 텍스트를 표시해야합니까? – ibtarek
주변 코드를 표시하십시오. –