HTML输入Onkeyup不触发 [英] Html Input Onkeyup not firing

查看:272
本文介绍了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

推荐答案

这在FF和Chrome中有效,如
所建议 此讨论

This works in FF and Chrome as suggested by
this discussion

<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;

    }

}


您可以尝试

You can try

<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不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆