<div style="position:relative">
<textarea id="remark" class="remarkstyle" maxlength="800" onkeyup="javascript:setLength(this,800,'wordslength');"></textarea>
<span id="wordslength" style="position:absolute; right:5px; bottom:3vh;font-size:12px; color:#BDCADA">0/800</span>
</div>
<style>
.remarkstyle{
border:1px solid #0376FE;
border-radius:10pt;
height:98%;
line-height: 1.5;
font-size:15pt;
margin-bottom: 2vh;
width:100%;
color: #000000;
overflow-x:hidden;
resize: none;
}
</style>
<script>
function setLength(obj,maxlength,id){
var num=obj.value.length;
if(num<0){
num=0;
}
document.getElementById(id).innerHTML=num+"/800";
}
</script>
HTML Textarea 800字限制的代码
猜你喜欢
转载自blog.csdn.net/weixin_44159662/article/details/110622012
今日推荐
周排行