标签:
http://q.cnblogs.com/q/60738/
用Jquery写的,可以实现隐藏功能,代码如下:
1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JqueryRadioButton.aspx.cs" Inherits="HtmlAgilityPackHtml.JqueryRadioButton" %> 2 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 5 <html xmlns="http://www.w3.org/1999/xhtml"> 6 <head runat="server"> 7 <title>点击RadioButton</title> 8 <script src="jquery-1.5.2.min.js" type="text/javascript"></script> 9 <style type="text/css"> 10 .hideclass 11 { 12 display:none; 13 } 14 </style> 15 <script type="text/javascript" language="javascript"> 16 $(function () { 17 $("#RadioButton1").change(function () { 18 $("#tr1").removeClass("hideclass"); 19 $("#tr2").addClass("hideclass"); 20 }) 21 22 $("#RadioButton2").change(function () { 23 $("#tr1").addClass("hideclass"); 24 $("#tr2").removeClass("hideclass"); 25 }) 26 27 }); 28 </script> 29 </head> 30 <body> 31 <form id="form1" runat="server"> 32 <div> 33 <table> 34 <tr> 35 <td>链接类型:</td> 36 <td colspan="2"> 37 <asp:RadioButton ID="RadioButton1" runat="server" Text="图片链接" GroupName="rdo" Checked="true"/> 38 <asp:RadioButton ID="RadioButton2" runat="server" Text="文字链接" GroupName="rdo" /> 39 </td> 40 </tr> 41 <tr id="tr1"> 42 <td><asp:Label ID="Label1" runat="server" Text="链接图片:"></asp:Label></td> 43 <td> 44 <asp:FileUpload ID="FileUpload1" runat="server" /> 45 <asp:Button ID="Button1" runat="server" Text="上传" /> 46 </td> 47 </tr> 48 <tr id="tr2" class="hideclass"> 49 <td><asp:Label ID="Label2" runat="server" Text="文字链接:"></asp:Label></td> 50 <td> 51 <asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox> 52 </td> 53 </tr> 54 </table> 55 </div> 56 </form> 57 </body> 58 </html>
标签:
原文地址:http://www.cnblogs.com/zkwarrior/p/5138833.html