document.write() 将内容写入文档,当前编辑位置为写入的内容的后一个字符。
document.writeln() 将内容写入文档,并添加一个换行符,当前编辑位置为写入的内容的后一行的起始位置
<script type="text/javascript">
var strName='name';
document.write(strName);
document.writeln(strName);
document.write(strName);
</script>
注 : 在网页中是看不到writeln的换行效果的,它是被浏览器表现为一个空格显示出来了。