我有一個函數應該顯示一個文本框,該文本框基於在下拉列表中選擇的選項。我已經在javascript中寫了這個,我也使用usercontrols。這裏是javascript函數的部分代碼。對象在JavaScript函數中未定義
function showhideeffectivedate(objIncType)
{
var inctype=objIncType.value;
if(inctype=='AMC'||inctype=='AMCW'||inctype=='CMC'||inctype=='CMCHF'||inctype=='CHF')
{
var Objtr_lbl_Healthy_Family_Member_Number = createObj("tr_lbl_Healthy_Family_Member_Number");
if(IsValidObj(Objtr_lbl_Healthy_Family_Member_Number))
{
if(inctype=='CHF')
{
HideAreaCrossBrowser('tr_lbl_Healthy_Family_Member_Number',false)
}
else
HideAreaCrossBrowser('tr_lbl_Healthy_Family_Member_Number',true)
healthyfamilyMemberCheck()
}
}
else
{
var Objtr_lbl_Healthy_Family_Member_Number = createObj('tr_lbl_Healthy_Family_Member_Number');
if(IsValidObj(Objtr_lbl_Healthy_Family_Member_Number))
{
HideAreaCrossBrowser('tr_lbl_Healthy_Family_Member_Number',true)
}
}
}
其中包含控制/文本.ascx文件代碼:
<tr class="Content" id="tr_lbl_Healthy_Family_Member_Number">
<td valign="top" colspan="2">
<table cellspacing="0" border="0">
<tr>
<td class="Content" align="right" id="td_lbl_Healthy_Family_Member_Number" width="130px">
<asp:Label ID="lbl_Healthy_Family_Member_Number" CssClass="Content" runat="server" Text="Healthy Family Member Number" />
</td>
<td class="Content" align="left" id="td_txt_Healthy_Family_Member_Number" width="185px">
<%--<asp:HiddenField runat="server" Value="td_txt_Healthy_Family_Member_Number" ID="hdn_help_11999" />--%>
<asp:TextBox ID="txt_Healthy_Family_Member_Number" CssClass="inputbox" onblur="" runat="server"
Enabled="True" />
</td>
</tr>
</table>
</td>
</tr>
我試圖調試代碼。此代碼不檢查'CHF'的情況。它跳過整個循環,並說變量'Objtr_lbl_Healthy_Family_Member_Number'沒有對象/未定義?
感謝您的幫助。
你可以包含你的'createObj()'函數嗎? – Ben 2011-05-24 00:15:27