本文介绍了javascript功能由于默认按钮而无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在页面加载中,我设置了默认按钮,例如
on pageload i set default button like
this.Form.DefaultButton = ImageButton2.UniqueID;
由于这个原因,某些数字代码脚本无法在表单中使用
代码是
due to this some number code script is not working in form
the code is
<script type="text/javascript">
function alpha(e)
{
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k==32);
}
</script>
<asp:TextBox ID="txtpartyhallname" runat="server" Width="200px" CssClass="WaterMarkedTextBox" onkeypress="return alpha(event)" >
我只允许在此文本框中输入文本.
需要任何建议
I have to allow text only in this textbox.
Any suggestions required
推荐答案
this.Form.DefaultButton = ImageButton2.UniqueID;
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
function alpha(e)
{
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k==32 || k==13);
}
</script>
<asp:TextBox ID="txtpartyhallname" runat="server" Width="200px" CssClass="WaterMarkedTextBox" onkeydown="return alpha(event)" ></asp:TextBox>
<asp:ImageButton ID="ImageButton2" runat="server"
onclick="ImageButton2_Click" />
</asp:Content>
这篇关于javascript功能由于默认按钮而无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!