Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Populate a textbox by clicking a link

    Hi,

    i am trying to populate a text box on my page by clicking a link!

    I have absolutely no clue how to do it.

    here's the situation.

    I have a number of links on my page, with a textbox underneath. I want the textbox to be populated with a result depending on what link is clicked.

    if another link is clicked afterwards, the textbox should clear the previous result and then populate with the new result.

    can anybody help me please.

    Thanks very much

    Chris

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--

    function 
    tb(obj,mess){
     
    document.getElementById(obj).value=mess;
    }

    //-->
    </script>

    </head>

    <body>
    <span onclick="javascript:tb('TB1','Text One');" >Link One</span><br>
    <span onclick="javascript:tb('TB1','Text Two');" >Link Two</span><br>
    <span onclick="javascript:tb('TB1','Text Three');" >Link Three</span><br>
    <input id="TB1" size="10">
    </body>

    </html> 


  •  

    Posting Permissions

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