日期:2014-05-17 浏览次数:20661 次
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script> <script type="text/javascript"> $(function () { $(".rb :input").bind("click", function (event) { var senderIndex = $(".rb :input").index($(this)); //alert(senderIndex); $(".mydiv").hide(); $($(".mydiv").get(senderIndex)).show(); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:RadioButton CssClass="rb" GroupName="rb" ID="rb01" runat="server" Text="rb01" Checked="true"/> <asp:RadioButton CssClass="rb" GroupName="rb" ID="rb02" runat="server" Text="rb02" /> <asp:RadioButton CssClass="rb" GroupName="rb" ID="rb03" runat="server" Text="rb03" /> </div> <div class="mydiv">mydiv01</div> <div class="mydiv" style=" display:none">mydiv02</div> <div class="mydiv" style=" display:none">mydiv03</div> </form> </body> </html>
------解决方案--------------------
<asp:RadioButton ID="rbtnHour" GroupName="cyc" Text="按时" runat="server" onclick="radio_class('1','true')" />
<asp:RadioButton ID="rbtnDay" GroupName="cyc" Text="按天" runat="server" onclick="radio_class('2','true')" />
<asp:RadioButton ID="rbtnWeek" GroupName="cyc" Text="按周" runat="server" onclick="radio_class('3','true')" />
<asp:RadioButton ID="rbtnMonth" GroupName="cyc" Text="按月" runat="server" onclick="radio_class('4','true')" />
<asp:RadioButton ID="rbtnYear" GroupName="cyc" Text="按年" runat="server" onclick="radio_class('5','true')" />
<asp:RadioButton ID="rbtnClass" GroupName="cyc" Text="轮班" runat="server" onclick="radio_class('6','true')" />
function radio_class(onvalue, flag) {
//只有轮班的时候才隐藏
document.getElementById('pFinish').style.display = "";
if (onvalue == 1) {
document.getElementById('aa').style.display = "";
document.getElementById('bb').style.display = "none";
document.getElementById('cc').style.display = "none";
document.getElementById('dd').style.display = "none";
document.getElementById('ee').style.display = "none";
document.getElementById('ff').style.display = "none";