一 实例
<script language='javascript'>document.writeln("<pre>");document.writeln("轻松学习\nJavaScript语言!");document.writeln("</pre>");document.writeln("快快乐乐\n平平安安!");</script>
二 运行结果
轻松学习 JavaScript语言!快快乐乐 平平安安!
三 代码分析
1、在document.writeln();语句中使用转义字符时,只有将其放在格式化文本块中才会起作用,所以脚本必须在<pre>和</pre>的标签内。
2、如果不使用<pre>和</pre>的标签,则转义字符不起作用。
3843

被折叠的 条评论
为什么被折叠?



