JavaScript换行
<script language="JavaScript"><!--todayDate = new Date();date = todayDate.getDate();month= todayDate.getMonth()+1;year= todayDate.getYear();document.write("今天是")document.write(" ")document.write(year);document.write("年");document.write(month);document.write("月");document.write(date);document.write("日");document.write(" ")document.writeln( )if (todayDate.getDay() == 5) document.write("星期五")if (todayDate.getDay() == 6) document.write("星期六")if (todayDate.getDay() == 0) document.write("星期日")if (todayDate.getDay() == 1) document.write("星期一")if (todayDate.getDay() == 2) document.write("星期二")if (todayDate.getDay() == 3) document.write("星期三")if (todayDate.getDay() == 4) document.write("星期四")//--></script>上面这段插入网页后,写成一行的,怎么让星期几另起一行呢(输出换行)
参考答案:document.write(" ") 改为 document.write("<br>") 即可。