--- title: document.writeln slug: Web/API/Document/writeln translation_of: Web/API/Document/writeln ---
{{ ApiRef() }}
向文档中写入一串文本,并紧跟着一个换行符。
document.writeln(line);
line
为包含文本的字符串document.writeln("<p>enter password:</p>");
document.writeln 和 document.write 一样,但是会添加一个换行符。
NS_ERROR_DOM_NOT_SUPPORTED_ERR
) error on the error console). This is the case if opening a local file with a .xhtml file extension or for any document served with an application/xhtml+xml MIME type. More information is available in the W3C XHTML FAQ.{{ languages( { "ja": "ja/DOM/document.writeln", "pl": "pl/DOM/document.writeln" } ) }}