How to access ie a html textbox on a web user control?

H

Henke

On a web user control I add a html textbox and a html button. To the onclick
event off the button I add a call to myFunc() that resides on my aspx-page
in a script section. In this function I'd like to set the value of the
textbox to some text. I do like this:
function myFunc()
{
textbox.value = "some text";
}

When the code is executed I get a "textbox is null or undefined"
I know a work around and that is if I put my web user control on a form
(myForm) and in the myFunc changes textbox.value to myForm.textbox.value
everything works. But as you understand it's not a good idea to hardcode the
name of the form in the user control.
Any ideas?
/Henke
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top