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
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    "pass arguments"

    Hello,

    I have 10 web links on my index but at the top my page is there one <input type="text" name="myurls"> So I want to create an effect like the following:

    <a href="http://www.yahoo.com">Yahoo!</a> <a href="#">click add</a>

    When some user press to the "click add" link the url link http://www.yahoo.com is passed on <input type="text" name="myurls"> and if the same user click on other link the present link disappears and the new is writing.

    Regards and thanks for all help/helpers.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    You could try something llike this

    PHP Code:
    <script type="text/javascript">

    function 
    addUrl(v){

    document.forms["myform"]["myurls"].value=document.getElementById(v).href

    return false

    }

    </script>

    <a id="lnk1" href="http://www.yahoo.com">Yahoo!</a> <a href="#" onclick="return addUrl('lnk1')">click add</a>
    <BR>
    <a id="lnk2" href="http://www.codingforums.com">Codingforums.com</a> <a href="#" onclick="return addUrl('lnk2')">click add</a>

    <form name="myform">
    <input type="text" name="myurls" style="width:200px">
    </form> 
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

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