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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    84
    Thanks
    47
    Thanked 0 Times in 0 Posts

    How do I redirect this?

    I have this script on my page and the keyword is passed from the url. The script currently uses the link with type "amzn", but I want to automatically redirect through this link instead of having to click on it. Since it is in "a" tags, I have no idea how this may be done.

    Code:
    <SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822/US/boclsh-20/8005/97ce5f0a-6b0b-4632-afae-fada4cb1c294"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fboclsh-20%2F8005%2F97ce5f0a-6b0b-4632-afae-fada4cb1c294&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>
    <a type="amzn"><?php echo $_GET["keyword"]; ?></a>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,189
    Thanks
    80
    Thanked 4,561 Times in 4,525 Posts
    I assume that the <script> there finds the <a type="amzn"> tag and then alters it to make it into a clickable link, yes?

    So why not just do this:
    Code:
    ...
    <body onload="document.getElementById('GOTHERE').click( );">
    ....
    <a id="GOTHERE" type="amzn">....</a>
    ...
    ???

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,189
    Thanks
    80
    Thanked 4,561 Times in 4,525 Posts
    Note: If necessary...if the amazon script sets itself up to execute via onload, also, you might do this at the VERY END of your page:
    Code:
    ...
    <script>
    function wham( )
    {
        document.getElementById('GOTHERE').click( );
    }
    setTimeout( "when( )", 500 );
    </script>
    </html>
    Or something along those lines.

  • #4
    New Coder
    Join Date
    Sep 2006
    Posts
    84
    Thanks
    47
    Thanked 0 Times in 0 Posts
    Thanks for your help......I think you're right that the script uses the type=amzn to identify the link and make it clickable. I tried your suggestions in every combination and they did not seem to work. The page still displays a link with the text of the keyword passed by the url string.

    The page is hosted at http://www.affanalytics.com/direct/a...p?keyword=hose (just as an example)

    I'll add the entire HTML so you can see what I've got. I know almost nothing about programming so I'm really lost here. Thanks.

    Code:
    <!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=iso-8859-1" />
    <title>Amazon</title>
    </head>
    <body onload="document.getElementById('GOTHERE').click( );">
    <SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822/US/boclsh-20/8005/97ce5f0a-6b0b-4632-afae-fada4cb1c294"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fboclsh-20%2F8005%2F97ce5f0a-6b0b-4632-afae-fada4cb1c294&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>
    <a id="GOTHERE" type="amzn"><?php echo $_GET["keyword"]; ?></a>
    <script>
    function wham( )
    {
        document.getElementById('GOTHERE').click( );
    }
    setTimeout( "when( )", 500 );
    </script>
    </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
    •