Results 1 to 4 of 4

Thread: how to display values in textbox?

  1. #1
    Join Date
    Apr 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow how to display values in textbox?

    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
    Last edited by sweetboy; 05-05-2007 at 11:54 AM. Reason: I need some more explantion

  2. #2
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default

    Sweetboy, you should really search the net for things like this.

    Code:
    <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>

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by sweetboy
    previous value must be retain in the textbox so that i take it as a word
    I think he might want += as in:

    Code:
    <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>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Ah...

    He may also then want to add a white space after the addition

    Code:
    <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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •