document.open(); document.write('content'); document.close();
將目前的顯示的網頁,覆蓋,內容為content。
document.open(); document.write('content'); document.writeln('content'); document.write('content<br>'); document.write('content<br>'); document.close();
writeln() 只是對應一般文字檔的換行,並不在網頁中換行,而是被視為一個空白。真的換行必須寫標籤<br>
。
document.open() document.write("<html>") document.write("<head>") document.write("</head>") document.write("<body>") document.write('<img src="0000.jpg" width="30%" height="30%">') document.write("</body>") document.write("</html>")
產生網路傳輸錯誤。因為<img>
標籤,會產生HTTP request GET
。