...

View Full Version : How do I redirect this?



jdblewitt
06-25-2009, 11:57 PM
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.



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

Old Pedant
06-26-2009, 05:34 AM
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:


...
<body onload="document.getElementById('GOTHERE').click( );">
....
<a id="GOTHERE" type="amzn">....</a>
...

???

Old Pedant
06-26-2009, 05:36 AM
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:


...
<script>
function wham( )
{
document.getElementById('GOTHERE').click( );
}
setTimeout( "when( )", 500 );
</script>
</html>


Or something along those lines.

jdblewitt
06-26-2009, 02:38 PM
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/amazon.php?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.



<!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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum