开发者

document.form[0] is Null or Not an Object error when hiding a text field in ASP.Net

开发者 https://www.devze.com 2022-12-26 18:04 出处:网络
I am hiding a TextBoxin my aspx page like this: myField.visible=false; Now I have a DropDown as well which tries to access the TextBox开发者_如何学编程 on IndexChange. The problem is, it cant access

I am hiding a TextBoxin my aspx page like this:

myField.visible=false;

Now I have a DropDown as well which tries to access the TextBox开发者_如何学编程 on IndexChange. The problem is, it cant access the hiffen TextBox and I am getting document.form[0] is Null or Not an Object. How can I solve that? Is the some check for that in JavaScript?

Thanks :-)


If you are trying to access the first form in the document via its numerical index (hint: You shouldn't be, the id attribute is very handy, then you are looking for the first in a group of forms, not the first in a group of form.

document.forms[0] // It is plural
0

精彩评论

暂无评论...
验证码 换一张
取 消