jquery 选中
<TD style="WHITE-SPACE: nowrap"><INPUT id=tveen3CheckBox title=区间1 type=checkbox name=tveen3CheckBox><A id=tveet3 class=tvee_0 href="javascript:SelectTreeNode(this, '132','0','区间1')">区间1</A></TD>
function SelectTreeNode(obj,nid,deph,nodename)
{
//如何将该A 标签平级的checkbox勾选上,下面这种方式不行啊
$(obj.parentElement).find(':checkbox').checked=true;
}
[解决办法]
function SelectTreeNode(that) { var c= $(that).siblings("input"); c.attr("checked",!c.attr("checked")); return false; }
[解决办法]
自己看吧,有你要的东东
<!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 id="Head1" runat="server"> <title></title> <link href="../images/mycss.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script><script type="text/javascript">//选中全部 sel_all = function(){ $('input[type="checkbox"]').attr("checked",true); } //取消全选 sel_none = function(){ $('input[type="checkbox"]').attr("checked",false); }</script><script language="javascript" type="text/javascript"> $(document).ready(function(){ $("#sel").change(function(){ var cid =$("#TypeList option:selected").val(); var state = $("#sel option:selected").val(); var str =$("#SerrchTex").val(); window.location.href="Default.aspx?state="+state+"&cid="+cid+"&str="+escape(str); }) var str = document.location.href; var urlList = str.split("="); var id = urlList[1]; //alert(id); $("#cpfb_"+id).css("color","#FF0000"); }) function sel() { var type=document.getElementById("SertypeList").options[document.getElementById("SertypeList").selectedIndex].value; if(type==1) { document.getElementById("TypeList").style.display='block'; document.getElementById("SerrchTex").style.display='none'; } else { document.getElementById("TypeList").style.display='none'; document.getElementById("SerrchTex").style.display='block'; } }function Ser_click(){ var re=/[^0-9]/; //var type=document.getElementById("SertypeList").options[document.getElementById("SertypeList").selectedIndex].value; var type2=document.getElementById("TypeList").options[document.getElementById("TypeList").selectedIndex].value; window.location.href="Default.aspx?cid="+type2+"&str="+document.getElementById("SerrchTex").value; }</script></head><body text="#333333" link="#333333" vlink="#333333" alink="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <form id="form1" runat="server"> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#3A76AF"> <tr> <td colspan="2" > <div style="border-bottom:solid 1px #3A76AF; color:#FFFFFf; width:100%; height:30px; line-height:30px; "><font color="#FFFFFF" style="font-weight:bold;"> → 信息管理</font></div></td> </tr> <tr bgcolor="#FFFFFF"><td colspan="2" height=5 align="cneter"> <table visible="false"> <tr> <td> <img src="../images/gif-0258.gif" width="35px" height="35px" /> </td> <td> 文章搜索 所属分类: </td> <td> <asp:DropDownList ID="TypeList" runat="server"></asp:DropDownList> </td> <td> 文章标题:<input id="SerrchTex" type="text" MaxLength="50" Width="120px" runat="server"/> </td> <td> <img src="../images/gif-0579.gif" onclick="return Ser_click()" style="cursor:pointer;" /> </td> </tr> </table></td></tr></table><asp:Repeater ID="RepNews" runat="server" OnItemCommand="RepNews_ItemCommand"> <HeaderTemplate> <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#05a3f8"> <tr> <td></td> <td height="23" style="color:#FFFFFF; font-weight:bold; text-align:center;">标题</td> <td height="23" style="color:#FFFFFF; font-weight:bold; text-align:center;">类别</td> <td height="23" style="color:#FFFFFF; font-weight:bold; text-align:center;">修改时间</td> <td height="23" style="color:#FFFFFF; font-weight:bold; text-align:center;">操作</td> </tr> </HeaderTemplate> <ItemTemplate> <tr bgcolor="#FFFFFF" onmouseover="this.style.backgroundColor='#cedff5'" onmouseout="this.style.backgroundColor='#FFFFFF'"> <td> <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Eval("id") %>' /> </td> <td height="23"><%# Eval("name") %></td> <td height="23" align="center"><%# Eval("cname")%></td> <td height="23" align="center"><%# Eval("addtime") %></td> <td height="23" align="center"><a href="EditNews.aspx?id=<%# Eval("id") %>">修 改</a> | <asp:LinkButton ID="LinkButton1" CommandName="del" CommandArgument='<%# Eval("id") %>' runat="server">删 除</asp:LinkButton></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate></asp:Repeater><div style="background:#FFFFFF; width:98%; margin-left:8px;"> <input type="button" value="全 选" onclick="sel_all()" /> <input type="button" value="反 选" onclick="sel_none()" /> <asp:Button ID="Button1" runat="server" Text="删除选中项" OnClientClick="return confirm('您确定要删除吗,一旦删除将无法找回')" onclick="Button1_Click" /> <webdiyer:aspnetpager ID="AspNetPager1" runat="server" CssClass="formfield" CustomInfoClass="formbutton" CustomInfoHTML="第<font color='red'><b>%CurrentPageIndex%</b></font>页 共%PageCount% 页 %StartRecordIndex%-%EndRecordIndex%" CustomInfoTextAlign="Center" FirstPageText="首页" horizontalalign="Center" InputBoxStyle="width:19px" LastPageText="尾页" meta:resourceKey="AspNetPager1" NextPageText="下一页" onpagechanged="AspNetPager1_PageChanged" PageSize="10" PrevPageText="前一页" showcustominfosection="Left" ShowInputBox="Always" ShowNavigationToolTip="True" style="FONT-SIZE: 14px" SubmitButtonClass="formfield" SubmitButtonText="GO" width="506px"> </webdiyer:aspnetpager></div> </form></body></html>