onkeypress没有在谷歌Chrome中解雇 [英] onkeypress not firing in google chrome

查看:99
本文介绍了onkeypress没有在谷歌Chrome中解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我...........

,因为我想在用户输入输入按钮后立即激活搜索按钮



代码是,

 <   script     type   =   text / javascript >  





函数doClick(btnSearch,e){
//此函数的目的是允许输入键
//指向正确的按钮点击。
var key;

if(window.event)
key = window.event.keyCode; // IE
else
key = e.which // firefox

if(key == 13){
//获取用户想要拥有的按钮点击
// var btn = document.getElementById(<% = btnSearch.ClientID %> );
var btn = $ get(btnSearch);
<% - var b = document.getElementById(' <%= btnSearch.ClientID%>'); - %>
if(btn!= null){//如果我们找到按钮,请点击它
btn.click();
event.keyCode = 0
}
}
}
< / script >







在这样的cs页面中使用onkeypress



 txtName.Attributes.Add(  onkeypress  doClick(' + btnSearch.ClientID +  ','event)) ; 
txtRid.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ,事件));
txtEmail.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ,事件));
txtMobile.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ',event));

解决方案

get(btnSearch);
<% - var b = document.getElementById(' <%= btnSearch.ClientID%>'); - %>
if(btn!= null){//如果我们找到按钮,请点击它
btn.click();
event.keyCode = 0
}
}
}
< / script >







在这样的cs页面中使用onkeypress



 txtName.Attributes.Add(  onkeypress  doClick(' + btnSearch.ClientID +  ','event)) ; 
txtRid.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ,事件));
txtEmail.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ,事件));
txtMobile.Attributes.Add( onkeypress doClick(' + btnSearch.ClientID + ,事件));


please help me...........
because i want to activate the search button when user as soon as enter the 'Enter button'

code is,

<script type="text/javascript">





        function doClick(btnSearch, e) {
            //the purpose of this function is to allow the enter key to
            //point to the correct button to click.
            var key;

            if (window.event)
                key = window.event.keyCode;     //IE
            else
                key = e.which    //firefox

            if (key == 13) {
                //Get the button the user wants to have clicked
                //var btn = document.getElementById(<%=btnSearch.ClientID%>);
                var btn = $get(btnSearch);
                      <%--var b = document.getElementById('<%=btnSearch.ClientID%>');--%>
                if (btn != null) { //If we find the button click it
                    btn.click();
                    event.keyCode = 0
                }
            }
        }
    </script>




am using onkeypress in cs page like this

txtName.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtRid.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtEmail.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtMobile.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");

解决方案

get(btnSearch); <%--var b = document.getElementById('<%=btnSearch.ClientID%>');--%> if (btn != null) { //If we find the button click it btn.click(); event.keyCode = 0 } } } </script>




am using onkeypress in cs page like this

txtName.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtRid.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtEmail.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");
            txtMobile.Attributes.Add("onkeypress", "doClick('" + btnSearch.ClientID + "',event)");


这篇关于onkeypress没有在谷歌Chrome中解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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