Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.

View in English Always switch to English

Document.writeln()

Deprecated

Avoid using this feature in new projects. The dynamic markup insertion API, which includes document.write(), has "very idiosyncratic behavior" which can be difficult to debug. This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: DOM.

Grava uma seqüência de texto, seguido por um caractere de nova linha a um documento.

Sintaxes

document.writeln(line);

Parâmetros

  • lineé uma string contendo uma linha de texto.

Exemplo

document.writeln("<p>enter password:</p>");

Notas

document.writeln é o mesmo que document.write mas acrescenta uma nova linha.

Nota: document.writeln (like document.write) does not work in XHTML documents (you'll get a "Operation is not supported" (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.

Especificação

writeln