<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>
<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>
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。