Newbie questio, null or not an object

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!
 
H

Henke

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top