Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to populate a label 2

Status
Not open for further replies.

ksbigfoot

Programmer
Joined
Apr 15, 2002
Messages
856
Location
CA
I have three text boxes and as each text box changes, I want to populate a label based on the concatenation of the three text boxes.
Is there a way to do this?
I picked a label over a textbox as it is just something that the user should be able to see but not modify.

Thanks
 
Regardless of whether you use a label element (which is probably not the correct element anyway) or a span element (which is probably more correct), you can target the element and set it's innerHTML using javascript - no problem. To assist in this, you may wish to assign the element an ID and then use document.getElementById() to target it.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
sure. like this:

Code:
<form name="blah">
<label name="lblOne" id="lblOne" for="txtOne">This</label>
<input type="text" name="txtOne" onkeyup="document.getElementById('lblOne').innerHTML = 'This ' + this.value;" />
</form>



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Howdy BabyJeffy & cLFlaVa,
thanks for the help, that is exactly what I was looking for.
I gave you both a star.
Thanks again,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top