PDA

View Full Version : how to display values in textbox?



sweetboy
05-05-2007, 06:37 AM
hi,

In my application labels and textbox is used..
in that whenever i click on the label the value present in label should be displayed in Text box..

i'm having five lables if i click first one it will display in text box and also if i click the second label the values already present in the text box should be there not
to be erased.
previous value must be retain in the textbox so that i take it as a word.can u get me?


how to display this ...
help me soon

Bob90
05-05-2007, 08:35 AM
Sweetboy, you should really search the net for things like this.


<input type="button" onclick="putValueInTextBox(this,'TB1')" value="ClickMe">
<input id="TB1" type="text">

<script type="text/javascript">
function putValueInTextBox(giver, taker)
{
document.getElementById(taker).value = giver.value;
}
</script>

jscheuer1
05-05-2007, 04:10 PM
previous value must be retain in the textbox so that i take it as a word

I think he might want += as in:


<input type="button" onclick="putValueInTextBox(this,'TB1')" value="ClickMe">
<input id="TB1" type="text">

<script type="text/javascript">
function putValueInTextBox(giver, taker)
{
document.getElementById(taker).value += giver.value;
}
</script>

Bob90
05-05-2007, 05:09 PM
He may also then want to add a white space after the addition




<input type="button" onclick="putValueInTextBox(this,'TB1')" value="ClickMe">
<input id="TB1" type="text">

<script type="text/javascript">
function putValueInTextBox(giver, taker)
{
document.getElementById(taker).value += giver.value+" ";
}
</script>

Or not... I'm don't understand