JS下如何实现换行?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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下如何实现换行?的主要内容,如果未能解决你的问题,请参考以下文章