日期:2014-05-17  浏览次数:20500 次

跪求在 asp.net中有4个文本框,验证至少填写其中3个才能进行查询,内容如下:请高手解答
[align=left][/align]<tr>
  <td class="dataLabel" width="12%">
  姓名:&nbsp;
  </td>
  <td width="28%">
  <asp:TextBox ID="txtInfoName" runat="server" MaxLength="50" TabIndex="0" 
  Width="150" ></asp:TextBox>
  </td>
  </tr> 
  <tr>
  <td class="dataLabel" width="12%">
  证件号码:
  </td>
  <td width="28%">
  <asp:TextBox ID="txtInfoNO" runat="server" MaxLength="50" TabIndex="0" 
  Width="150" ></asp:TextBox>
  </td>
  </tr>
  <tr>
  <td class="dataLabel" width="12%">
  移动电话:
  </td>
  <td width="28%">
  <asp:TextBox ID="txtMobPhone" runat="server" MaxLength="50" TabIndex="0" 
  Width="150" ></asp:TextBox>
  </td>
  </tr>
  <tr>
  <td class="dataLabel" width="12%">
  单位名字:
  </td>
  <td width="28%">
  <asp:TextBox ID="txtName" runat="server" MaxLength="50" TabIndex="0" Width="150"></asp:TextBox>
  </td>
  </tr>
  <tr> <td width="50%" align="right">
  <asp:Button ID="btnSearch" runat="server" Text="查询" CssClass="button" 
  onclick="btnSearch_Click" />
  </td></tr>


跪求各位老大们 解答啊 把代码写给我 js脚本 什么的都行啊

------解决方案--------------------
JScript code

if($("input[type='text']").filter(function(){return $(this).val()!=""}).length<3)
{
alert("至少填写其中3个才能进行查询");
}

------解决方案--------------------
var userName=document.getElementById("txtInfoName");
var cardId=document.getElementById("txtInfoNO");
var phone=document.getElementById("txtMobPhone");
var companyName=document.getElementById("txtName");
//总共有4种组合全部写上就好了
if(checkIsNull(userName.value,cardId.value,phone.value)||继续调用checkIsNull方法
function checkIsNull(a,b,c){
if(a!=""&&b!="&&c!=""){
return true;
}
return false;
}