62,074
社区成员
发帖
与我相关
我的任务
分享
<%@ Page EnableEventValidation="false" ValidateRequest="false" Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<!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>
<style>
.label
{
text-align:center; width:600px;
}
.red
{
color:#ff0000;
}
</style>
<script src="/js/jquery.js" charset="utf-8"></script>
<script>
jQuery(document).ready(function () {
var checklist = "1,1,2,3,4,1,5,1";
var arycheck = checklist.split(",");
jQuery(".table1 > tbody > tr").each(function (i, item) {
jQuery(item).find("input[type='radio'][value='" + arycheck[i] + "']").attr("checked", true);
//jQuery(item).find("input[type='radio']").eq(parseInt(arycheck[i]) - 1).attr("checked", true);
})
});
function checkForm() {
var _message = "";
var _obj;
jQuery(".red").removeClass("red")
jQuery(".table1 > tbody > tr").each(function (i, item) {
if (jQuery(item).find("input[type='radio']:checked").length <= 0) {
_obj = jQuery(item).find("input[type='radio']").eq(0);
_message += jQuery(item).find(".td1").eq(0).text() + "没有勾选 ";
jQuery(item).addClass("red");
//return false;
}
});
if (_message != "") {
alert(_message);
jQuery(_obj).focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table class="table1">
<tbody>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 1.1
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList1" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 1.2
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList4" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 1.3
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList5" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</tbody>
</table>
<table class="table1">
<tbody>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 2.1
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList2" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 2.2
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList6" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</tbody>
</table>
<table class="table1">
<tbody>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 3.1
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList3" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 3.2
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList7" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="td1">
<span style="color: #FF001E">*</span> 3.3
</td>
<td class="td2">
<span>标题1</span>
</td>
<td class="td3">
<asp:RadioButtonList ID="RadioButtonList8" RepeatDirection="Horizontal" runat="server"
CssClass="radio">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</tbody>
</table>
<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" CancelImageUrl="images/answer_bg.gif" DeleteImageUrl="images/banner1.jpg" />
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" Text="Button" UseSubmitBehavior="False" />
</form>
</body>
</html>