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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link manipulating?

    Hi there,

    just one short question for a JS newbie:

    I want to manipulate a normal href link with the onClick event.
    <a href="http://anywhere.com" onClick="action()">Link</a>

    The browser request should look like:
    'http://mypage.com/check.php?url=http://anywhere.com'

    In short: I want to attach a string (http://mypage.com/check.php?url=) to the url. But it's manadatory that the href tag (href="http://anywhere.com") stays! Is this even possible? I don't think so!?

    Any help or tips are appreciated! THANK YOU!

  • #2
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>test</title>
    <script type="text/javascript" >
    function action(me)
    {
    me.href="http://mypage.com/check.php?url="+me.href;
    }
    </script>
    </head>
    <body>
    <a href="http://anywhere.com" onClick="action(this);">Link</a>
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great! Thank you!


  •  

    Posting Permissions

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