<tr>
<td></td>
<td class="selection">
<asp:dropdownlist id="ddlWindSpeed" onchange="HideTextBox(this);" runat="server" />
</td>
<td class="formField">
<asp:textbox id="txtActualWindSpeed" MaxLength="50" runat="server" />
</td>
这是JS函数:
function HideTextBox(ddlId)
{
var ControlName = document.getElementById(ddlId.id);
if(ControlName.value == 0) //it depends on which value Selection do u want to hide or show your textbox
{
document.getElementById('txtActualWindSpeed').style.display = '';
}
else
{
document.getElementById('txtActualWindSpeed').style.display = 'none';
}
}
</tr>
使用它我收到此消息:
SCRIPT5007:无法获取属性'style'的值:object为null或undefined
知道我做错了什么吗? 谢谢,Laziale
答案 0 :(得分:0)
尝试document.getElementById('<%=txtActualWindSpeed.ClientID%>')