帮忙看下
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
<asp:Button ID="ButtonShow" runat="server" CssClass="button60" Text="顯示" OnClick="ButtonShow_Click" />
<script type="text/javascript">
$().ready(function() {
$('#<%=ButtonShow.ClientID%>').click(function() {
var errorInfo = "";
var beginHour = 0;
var beginMinute = 0;
var endHour = 0;
var endMinute = 0;
$('input:text').each(function(i) {
if(i<2)
{
var value = $.trim(this.value);
if(value == "")
{
return true;
}
var time = value.split(":");
if (value.length < 5 || time.length != 2) {
errorInfo += "<%=Html.EpsMessageLanguage("RS00049","请输入正确的时间格式!") %> \n";
return false;
}
if (i % 2 == 0) {
beginHour = parseInt(time[0]);
beginMinute = parseInt(time[1]);
if(isNaN(beginHour) || isNaN(beginMinute))
{
errorInfo += "<%=Html.EpsMessageLanguage("RS00034","请输入數字!") %> \n";
return false;
}
if (beginMinute != 0 && beginMinute != 30) {
errorInfo += "<%=Html.EpsMessageLanguage("RS00049","请输入正确的时间格式!") %> \n";
return false;
}
if (beginHour < 0 || beginHour > 24) {
errorInfo += "<%=Html.EpsMessageLanguage("RS00049","请输入正确的时间格式!") %> \n";
return false;
}
}
else
{
endHour = parseInt(time[0]);
endMinute = parseInt(time[1]);
if(isNaN(endHour) || isNaN(endHour))
{
errorInfo += "<%=Html.EpsMessageLanguage("RS00034","请输入數字!") %> \n";
return false;
}
if (endHour < 0 || endHour > 24) {
errorInfo += "<%=Html.EpsMessageLanguage("RS00049","请输入正确的时间格式!") %> \n";
return false;
}
if (endMinute != 0 && endMinute != 30) {
errorInfo += "<%=Html.EpsMessageLanguage("RS00049","请输入正确的时间格式!") %> \n";
return false;
}