日期:2014-05-18 浏览次数:20530 次
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="CheckBox.WebForm6" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div id="text"> <asp:TextBox ID="TextBox1" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox4" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox5" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox6" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox7" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox8" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox9" runat="server" Style="position: relative"></asp:TextBox> <asp:TextBox ID="TextBox10" runat="server" Style="position: relative"></asp:TextBox> </div> <input type="button" value="check" onclick="return check()" /> <script type="text/javascript" > function checkNull() { var status=true; var inputs =document.getElementById("text").getElementsByTagName("input"); for(var i=0;i<inputs.length;i++) { if(inputs[i].value!="" ) { status=false; } } return status; } function check() { if(checkNull()) { alert("不能全部為空"); return false; } } function trim(strText) { return strText.replace(/^\s+|\s+$/g, ''); } </script> </form> </body> </html>