在JavaScript中,Write和Writeln的区别
搜索引擎给我的答案是:
Write不可以换行,Writeln可以换行。
<script>
document.write("write");
document.writeln("writln");
</script>
但是我在浏览器当中看不到效果,
又搜索一下才发现在网页当中被显示为一个空格的形式展现出来。
针对这一特性,有看到说可以用预定义格式化标签来显示出来,自己试了一下,
<script> document.write("<pre>第一个write"); document.writeln("第一个writln"); document.write("第二个write"); document.writeln("第二个writln</pre>"); </script>
预览效果如下:
果然是一个非常细节的东西…学到了学到了