document.write() 將內容寫入文檔,當前編輯位置爲寫入的內容的後一個字符。
document.writeln() 將內容寫入文檔,並添加一個換行符,當前編輯位置爲寫入的內容的後一行的起始位置
<script type="text/javascript">
var strName='name';
document.write(strName);
document.writeln(strName);
document.write(strName);
</script>
注 : 在網頁中是看不到writeln的換行效果的,它是被瀏覽器表現爲一個空格顯示出來了。