本文介绍了HTML输入Onkeyup不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为HTML输入编写了一个OnKeyup.它在IE8中工作正常,但在Chrome中无法启动.
帮助我
Hy,
I wrote an OnKeyup for HTML Input. It works fine in IE8 but not firing in Chrome.
Help me
推荐答案
<textarea name="textarea" id="txtComments" rows="3" onkeyup='return fnMaxLength(this,"5");' style="width: 940px" ></textarea>
function fnMaxLength(field, maxChars) {
if (field.value.length >= maxChars) {
var object = "-More than " + maxChars + " characters have been entered.";
//errorAlert("error", "Maximum length error", object);
alert(object);
return false;
}
}
<html>
<head>
<script type="text/javascript">
function showPLPopup(txtCtrlName,tblName)
{ alert(txtCtrlName); }
</script>
</head>
<body>
<input id="txtPatientSrch" runat="server" maxlength="100" onkeypress="return showPLPopup('txtPatientSrch','tblMasterPatientList');" />
</body>
</html>
这篇关于HTML输入Onkeyup不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!