そのため、リストボックスの選択に基づいてコンテンツを非表示および表示しようとしています。ページの読み込み時にcssを使用して一部のコンテンツを非表示にし、特定のものが選択されたときに表示します。ほとんどは機能しますが、これらのラジオ ボタンが表示されない理由がわかりません。
ここにラジオボタンとラベルがあります...
<br /><!--View/Send By-->
<asp:Label ID="lblViewSend" runat="server" Text="View/Send as" style="display:none;"></asp:Label>
<asp:RadioButton ID="rdViewPrint" Text="View/Print" runat="server" OnClick="javascript:disableFields();" GroupName="viewSend" Checked="True" style="display:none; margin-left:10px;" />
<asp:RadioButton ID="rdEmail" Text="Email" runat="server" OnClick="javascript:emailFields();" GroupName="viewSend" style="display:none; margin-left:10px;" />
<asp:RadioButton ID="rdFax" Text="Fax" runat="server" OnClick="javascript:faxFields();" GroupName="viewSend" style="display:none; margin-left:10px;" />
リストボックスでアイテムが選択されたときにそれらを表示するJavaScript...
function lbSelected() {
var sel = document.getElementById('<%=lbPatientVisits.ClientID%>');
var listlength = sel.options.length;
document.getElementById('<%=lblViewSend.ClientID%>').style.display = "inherit";
document.getElementById('<%=rdViewPrint.ClientID%>').style.display = "inherit";
document.getElementById('<%=rdEmail.ClientID%>').style.display = "inherit";
document.getElementById('<%=rdFax.ClientID%>').style.display = "inherit";
//...plus more code that functions correctly...
}
ラベルはページに表示されるはずですが、ラジオ ボタンは表示されません。私もこれを少しバリエーションとして試しましたが、この方法でも機能しませんでした...
var rbtn = document.getElementById('<%=rdViewPrint.ClientID%>');
rbtn.style.display = 'inherit';
何が欠けているか、または見落としていますか? コードは通常のボタンとラベルでは正常に機能するようですが、ラジオ ボックスでは機能しませんか? 助けてくれてありがとう。