js如何换行
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js如何换行相关的知识,希望对你有一定的参考价值。
function RunGLNL()
var today=new Date();
var d=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var DDDD=(today.getYear()<100 ?
today.getYear()+1900:today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日";
DDDD = DDDD + " " + d[today.getDay()];
DDDD = DDDD+ " " + (CnDateofDateStr(today));
document.write(DDDD);
这段代码输出后为:2009年4月29日 星期三 农历:己丑年 四月初五 怎样分行显示,第一行显示2009年4月29日 星期三 第二行显示 农历:己丑年 四月初五
today.getYear()+1900:today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日<br>";
后面添加<br>就行了。 参考技术A 在DDDD中插入几个<br />就可以了
function RunGLNL()
var today=new Date();
var d=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var DDDD=(today.getYear()<100 ?
today.getYear()+1900:today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日";
DDDD = DDDD + "<br /> " + d[today.getDay()];
DDDD = DDDD+ "<br /> " + (CnDateofDateStr(today));
document.write(DDDD);
本回答被提问者和网友采纳
JS下如何实现换行?
如下代码:
<script language="JavaScript" type="text/javascript">
document.writeln("<SCRIPT>");
document.writeln("var message=\"one man army!\"");
document.writeln("var n=0;");
document.writeln("if (document.all)");
document.writeln("document.write(\'<font size=\"12px\" color=\"#d50000\">\')");
document.writeln("for (m=0;m<message.length;m++)");
document.writeln("document.write(\'<span id=\"neonlight\" style=\"font-size:12px\">\'+message.charAt(m)+\'<\/span>\')");
document.writeln("document.write(\'<\/font>\')");
document.writeln("var tempref=document.all.neonlight");
document.writeln("");
document.writeln("else");
document.writeln("document.write(message)");
document.writeln("function neon()");
document.writeln("if (n==0)");
document.writeln("for (m=0;m<message.length;m++)");
document.writeln("tempref[m].style.color=\"#ffffff\"");
document.writeln("");
document.writeln("tempref[n].style.color=\"#d50000\"");
document.writeln("if (n<tempref.length-1)");
document.writeln("n++");
document.writeln("else");
document.writeln("clearInterval(flashing)");
document.writeln("setTimeout(\"beginneon()\",2500)");
document.writeln("return");
document.writeln("");
document.writeln("");
document.writeln("function beginneon()");
document.writeln("if (document.all)");
document.writeln("flashing=setInterval(\"neon()\",150)");
document.writeln("");
document.writeln("beginneon()");
document.writeln("<\/SCRIPT>");
</script>
这是一个类似打字效果的JS网页特效.但是无法实现多行显示.
就算在document.writeln("var message=\"one man army!\"");中加入<br>也无法实现换行.他会把<br>一同显示出来.
各位大牛......如何换行.
我不会JS!!
<br>无效......
以上是关于js如何换行的主要内容,如果未能解决你的问题,请参考以下文章