gpt4 book ai didi

javascript - onkeypress 事件在 Firefox 中不起作用?如何解决?

转载 作者:行者123 更新时间:2023-11-29 15:44:49 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
onKeyPress event not working in Firefox

<div><textarea maxlength="1000" rows ="5" cols ="5" 
style="width:398px; height: 175px; overflow: auto; padding: 4px !important"
name="body" value="" id="body" onkeypress="imposeMaxLength(this, 10);"
onPaste="imposeMaxLength(this, 10);" /></textarea></div>
<script>
function imposeMaxLength(field, MaxLen){

if (field.value.length > (MaxLen-1)) {
alert("It cannot exceed " + MaxLen + " characters.");
field.value= field.value.substr(0, (MaxLen);
}
}
</script>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com