javascript中writeln的意思是什么
时间:2022-02-11 17:25
在JavaScript中,writeln的意思是“换行输出”,用于向文档写入HTML表达式或JavaScript代码,并且在每个表达式后写一个换行符,语法为“document.writeln(exp1,exp2,exp3,....)”。 本教程操作环境:windows10系统、javascript1.8.5版、Dell G3电脑。 javascript中writeln的意思是什么 write() 方法可向文档写入 HTML 表达式或 JavaScript 代码。 可列出多个参数(exp1,exp2,exp3,...) ,它们将按顺序被追加到文档中。 writeln() 方法与 write() 方法作用相同,外加可在每个表达式后写一个换行符。 语法如下: exp1表示要写入的输出流。它们将按顺序被追加到文档中。 示例如下: 输出结果: 【相关推荐:javascript学习教程】 以上就是javascript中writeln的意思是什么的详细内容,更多请关注gxlsystem.com其它相关文章!document.writeln(exp1,exp2,exp3,...)
<html>
<head>
<meta charset="utf-8">
<title>123</title>
</head>
<body>
<p>注意write()方法不会在每个语句后面新增一行:</p>
<pre>
<script>
document.write("Hello World!");
document.write("Have a nice day!");
</script>
</pre>
<p>注意writeln()方法在每个语句后面新增一行:</p>
<pre>
<script>
document.writeln("Hello World!");
document.writeln("Have a nice day!");
</script>
</pre>
</body>
</html>