本教程操作环境:windows10系统、javascript1.8.5版、dell g3电脑。
javascript中writeln的意思是什么
write() 方法可向文档写入 html 表达式或 javascript 代码。
可列出多个参数(exp1,exp2,exp3,...) ,它们将按顺序被追加到文档中。
writeln() 方法与 write() 方法作用相同,外加可在每个表达式后写一个换行符。
语法如下:
document.writeln(exp1,exp2,exp3,...)
exp1表示要写入的输出流。它们将按顺序被追加到文档中。
示例如下:
<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>
输出结果:
【相关推荐:javascript学习教程】
以上就是javascript中writeln的意思是什么的详细内容。
