Newbie questio, null or not an object

  • Thread starter Thread starter Henke
  • Start date Start date
H

Henke

To an WebForm I add a HTML button and a HTML TextBox, txt1.
On the onclick event of the button I call a function called test, The
function looks like this:
<script>
function test()
{
txt1.value = "test";
}
</scipt>

When i run the application I get an error message:
"txt1 is null or not an object"

Why does this happens?
Thanks!
 
Exactly, now it works on a form, thanks!

Do you know how to do it when working with web user controls. If I have a
button, a text box and my test() function on a user control I get the same
problem. If I add the user control to a form called myForm and in the
test-function write myForm.txt1.value = "test" then it works, but I'd like
to be able to put my user controls on other forms then the ones called
myForm...

Thanks!
 
Back
Top