苦費了一些力氣,貼碼不說話
<P>
<asp:label id="Label8" runat="server" Width="90" Font-Names="Arial Rounded MT Bold" Font-Size="9pt"
ForeColor="Blue">請選擇列印格式:</asp:label>
<asp:RadioButtonList id="RadioButtonList2" tabIndex="3" runat="server" Width="120px" Height="8px" Font-Names="新細明體"
Font-Size="9pt" ForeColor="Blue" RepeatLayout="Flow" RepeatDirection="Horizontal" RepeatColumns="2" οnclick="getRadioSelectedValue();">
<asp:ListItem Value="0" Selected="True" >明細</asp:ListItem>
<asp:ListItem Value="1" >匯總</asp:ListItem>
</asp:RadioButtonList></P>
<DIV id="ca">
<asp:CheckBox id="CheckBox1" tabIndex="10" runat="server" Font-Names="新細明體" Font-Size="9pt" ForeColor="Blue"
Text="不同客戶(廠商)是否跳頁?"></asp:CheckBox></DIV>
<script language="javascript">
function getRadioSelectedValue()
{
var radioList=document.getElementById("RadioButtonList2");
var options = radioList.getElementsByTagName('input');
var fa;
for(i=0;i<options.length;i++)
{
var opt = options[i];
if(opt.checked){fa=opt.value;break;}
}
if (fa=="1")
{ document.getElementById("ca").style.visibility="hidden";}
else
{ document.getElementById("ca").style.visibility="visible";}
}
</script>
參考來源:http://metadeveloper.blogspot.com/2006/05/radiobuttonlist-javascript-accessible.html