【问题标题】:RadioButtonList without the Radio Button Circle?RadioButtonList 没有单选按钮圈?
【发布时间】:2011-01-03 01:11:21
【问题描述】:

基本上,我只想要上面没有单选按钮的 RadioButtonList,我将对 rbl 进行编码,以便所选项目具有不同的背景颜色并使其看起来更专业,我希望能够摆脱单选按钮本身就外观而言...如果您知道任何方法,请告诉我!

【问题讨论】:

    标签: asp.net vb.net webforms radio-button radiobuttonlist


    【解决方案1】:

    这对我帮助很大: http_://www.ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

    此链接已损坏,原所有者..永远离线,所以内容

    也许对于任何阅读本文的人,可以尝试在 css 的输入中将背景设置为无

    <style>
       input {
          background:none !important;
       }
    </style>
    

    【讨论】:

    • 谢谢,这并没有消除单选按钮左侧的空心圆圈,但它仍然是一个很好的资源,我已将其添加为书签,会为你投票。
    【解决方案2】:

    如果不将一些技巧与 javascript 混合,我想不出任何简单的方法。

    这可能是您想要的:
    Accessible, Custom Designed Checkbox and Radio Button Inputs Styled with CSS (and a dash of jQuery)

    stand-a-lone demo here

    用于模仿单选按钮的图片:
    (来源:filamentgroup.com

    【讨论】:

    • 谢谢,但这并不能消除单选按钮左侧的空心圆圈
    • 但那些是图像。请参阅我的更新答案。您可以创建自己的无空心圆圈。
    • 我明白你在说什么,谢谢,将使用它作为最后的手段,仍在寻找一个可爱的 style="button: dissapear.and.dont.come.back" 类型 css 样式: )
    【解决方案3】:

    找到了一个可行的解决方案...

        <head runat="server">
        <title>Test - Hide radio circles from radiobuttonlist</title>
        <script type="text/javascript">
        function hideRadioSymbol()
        {
            var rads = new Array();
            rads = document.getElementsByName('list1'); //Whatever ID u have given to ur radiolist.
            for(var i = 0; i < rads.length; i++)
                document.getElementById(rads.item(i).id).style.display = 'none'; //hide
        }
        </script>
        </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:RadioButtonList ID="list1" runat="server">
                <asp:ListItem Value="item1" Text="item1"></asp:ListItem>
                <asp:ListItem Value="item2" Text="item2"></asp:ListItem>
            </asp:RadioButtonList>
        </div>
        <script type="text/javascript">hideRadioSymbol()</script> //After list is completely rendered/loaded.
        </form>
    </body>
    </html>
    

    哦,顺便说一句,mvc 太棒了,asp.net 应该从一开始就是这样!

    【讨论】:

    • 像往常一样,stackoverflow 只是删除了所有的 html,代码发布网站的默认逻辑还不错!
    • 选择 101010 按钮将代码缩进 4 个空格并保留格式。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-06
    • 1970-01-01
    • 1970-01-01
    • 2012-03-30
    相关资源
    最近更新 更多