请孟子和其他大虾进来帮下忙,关于checkbox的问题~~~
请先看下http://dotnet.aspx.cc/ShowDetail.aspx?id=F43AF9A5-2C2E-4AA6-E976-21E9569F5A8A
这个是孟大大的关于checkbox的文章,我的问题和他的需求差不多,但是需要一选择就出结果,而不是再点击按钮,我的代码完成了一部分,主要是在分页后无法保存上一页的值,而且不太清楚如何在返回上页时将以前选中的checked了,请耐心看下我的代码:JS的
function checkbox_onchange() {
var CatchHERa = GridView1.all.tags( "INPUT ");
var eleValue = document.all[ "eleValue "];
var eleName = document.all[ "eleName "];
//alert(document.all[ "eleValue "].value);
eleValue.value = eleName.value = " ";
for (var i=0; i <CatchHERa.length; i++) {
if (CatchHERa[i].checked) {
var tdl = CatchHERa[i].parentNode;
while (tdl.tagName != "TR ")
tdl = tdl.parentNode;
alert(eleValue.value);
eleValue.value = ((eleValue.value == " ") ? tdl.cells[2].innerText : eleValue.value + ", " + tdl.cells[2].innerText);
eleName.value = ((eleName.value == " ") ? tdl.cells[2].innerText : eleName.value + ", " + tdl.cells[2].innerText);
}
}
ASPX页的,我用的是VS2005 的GRIDVIEW
<form id= "form1 " runat= "server ">
<asp:GridView ID= "GridView1 " runat= "server " AutoGenerateColumns= "False " DataSourceID= "ObjectDataSource1 " AllowPaging= "True " OnRowDataBound= "GridView1_RowDataBound ">
<Columns>
<asp:BoundField DataField= "STATIONID " HeaderText= "STATIONID " SortExpression= "STATIONID " />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID= "chkSelect " runat= "server " onclick= "checkbox_onchange() "/>
</ItemTemplate>
</asp:TemplateField>
&nb