【发布时间】:2011-01-03 01:11:21
【问题描述】:
基本上,我只想要上面没有单选按钮的 RadioButtonList,我将对 rbl 进行编码,以便所选项目具有不同的背景颜色并使其看起来更专业,我希望能够摆脱单选按钮本身就外观而言...如果您知道任何方法,请告诉我!
【问题讨论】:
标签: asp.net vb.net webforms radio-button radiobuttonlist
基本上,我只想要上面没有单选按钮的 RadioButtonList,我将对 rbl 进行编码,以便所选项目具有不同的背景颜色并使其看起来更专业,我希望能够摆脱单选按钮本身就外观而言...如果您知道任何方法,请告诉我!
【问题讨论】:
标签: asp.net vb.net webforms radio-button radiobuttonlist
这对我帮助很大: http_://www.ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
此链接已损坏,原所有者..永远离线,所以内容
也许对于任何阅读本文的人,可以尝试在 css 的输入中将背景设置为无
<style>
input {
background:none !important;
}
</style>
【讨论】:
如果不将一些技巧与 javascript 混合,我想不出任何简单的方法。
这可能是您想要的:
Accessible, Custom Designed Checkbox and Radio Button Inputs Styled with CSS (and a dash of jQuery)
用于模仿单选按钮的图片:
(来源:filamentgroup.com)
【讨论】:
找到了一个可行的解决方案...
<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 应该从一开始就是这样!
【讨论】:
101010 按钮将代码缩进 4 个空格并保留格式。