RadioButton如何隐藏和替换

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"/>&nbsp;
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>
复制代码

 

 
复制代码
posted @   _海阔天空  阅读(1167)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
点击右上角即可分享
微信分享提示