js获取文本的行数 <div class="txt" style="line-height:30px">我是文字<br>我是文字<br>我是文字<br>我是文字</div> <script> //高度/行高=文本行数 var rowNum=Math.round($(".txt").height()/parseFloat($(".txt").css('line-height'))); alert("当前有"+rowNum+"行"); </script> posted @ 2017-08-08 09:33 <_/> 阅读( ...) 评论( ...) 编辑 收藏