各们大虾,我在.aspx页面中写了如下JS的代码:
function checkInfo()
{
Alert("ssss");
var tname=document.getElementById("<%=txtName.ClientID%>").value;
var tpwd=document.getElementById("<%=txtPwd.ClientID%>").value;
var tcount=document.getElementById("<%=txtMembCount.ClientID%>").value;
var ttel=document.getElementById("<%=txtTel.ClientID%>").value;
if(tname=="" || tname==null)
{
Alert("请填写您的公会名称!");
return false;
}
if(tpwd=="" || tpwd==null)
{
Alert("请填写您的公会密码!");
return false;
}
if(tcount=="" || tcount==null)
{
Alert("请填写预计人数!");
return false;
}
if(ttel=="" || ttel==null)
{
Alert("请填写您的手机号!");
return false;
}
}然后button的调用JS如下:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return checkInfo()" />
可是为什么就是不是执行checkInfo()呢?
Alert("ssss");也没弹出来,请问是什么回事呢?
function checkInfo()
{
Alert("ssss");
var tname=document.getElementById("<%=txtName.ClientID%>").value;
var tpwd=document.getElementById("<%=txtPwd.ClientID%>").value;
var tcount=document.getElementById("<%=txtMembCount.ClientID%>").value;
var ttel=document.getElementById("<%=txtTel.ClientID%>").value;
if(tname=="" || tname==null)
{
Alert("请填写您的公会名称!");
return false;
}
if(tpwd=="" || tpwd==null)
{
Alert("请填写您的公会密码!");
return false;
}
if(tcount=="" || tcount==null)
{
Alert("请填写预计人数!");
return false;
}
if(ttel=="" || ttel==null)
{
Alert("请填写您的手机号!");
return false;
}
}然后button的调用JS如下:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return checkInfo()" />
可是为什么就是不是执行checkInfo()呢?
Alert("ssss");也没弹出来,请问是什么回事呢?
=>
OnClick="checkInfo()"
试下看看