运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Document Object</h1> <h2>The write() and writeln() Methods</h2> <p>write() does NOT add a new line (CR) after each statement.</p> <p>writeln() DOES add a new line (CR) after each statement.</p> <pre> <script> document.write("Hello World!"); document.write("Have a nice day!"); document.write("<br>"); document.writeln("Hello World!"); document.writeln("Have a nice day!"); </script> </pre> <p>It makes no sense to use writeln() in HTML.</p> <p>Carriage return (CR) is ignored in HTML.</p> </body> </html>