读书人

JS挟制换行

发布时间: 2013-04-20 19:43:01 作者: rapoo

JS强制换行

$(function() {$(".word_break").each(function() {var word = $(this).text();var step = 25;//步长var len = word.length;   if(len > step) {   var newWord = new Array();   for(var i = step; i < len+step; i+=step) {   newWord.push(word.substring(i-step,i));   newWord.push("<br>");   }   $(this).html(newWord.join(""));   }});})

?

读书人网 >JavaScript

热点推荐