JS实现段落内换行
问题出在哪里啊,下面贴代码,求高人解答!!!!!!!!
我就是想问下,那个P里面的段落如何实现分段啊,就是类似BR之类的功能,
我指定多少个字符,出现一次BR
<script type="text/javascript">function autoBr(max1){var maxVal=document.getElementById("right");var maxVal_Val=maxVal.childNodes.item(1).childNodes.item(0);var maxVal_3=maxVal.childNodes.item(1);var final_var=maxVal_3.innerHTML;var final_Length=maxVal_3.length;var temp="";while(final_Length>max1){ temp=temp+final_var.substr(0,max1)+"\n"; final_var=final_var.substr(max1,final_Length);}temp=temp+"\n"+final_var;final_var=temp;}function testYes(){ autoBr(10); }</script><body onload="testYes()"><div id="right"> <h3 class="title"><a href="<!--{$url_about}-->" title="More" class="more">More</a><span>公司简介</span></h3> <div class="text"> <div class="editor"> <!--{if $ads_zone2}--> <!--{foreach $ads_zone2 as $volist}--> <img width="<!--{$volist.width}-->" height="<!--{$volist.height}-->" hspace="2" align="left" vspace="2" src="<!--{$volist.uploadfiles}-->" style="float:right" /> <!--{/foreach}--> <!--{/if}--> <p><!--{$config.about|filterhtml:435}--></p> </div></body>