Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have a php rotator script that allows individual links for each picture in the rotator, however when you click on the picture it opens a new web browser window. How can I edit the script so that the links open in the same window they where clicked from?
Here is the scriptCode: Select all
<?
/*
MY RANDOM IMAGE DISPLAYER Version 1.00
Copyright (C) 2001 Mert Yaldýz - mertyaldiz@yahoo.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// modify the 7 lines below
$banners= array('images/theme/psp/GTA1.jpg','images/theme/psp/GTA2.jpg','images/theme/psp/NBALive06.jpg','images/theme/psp/SWBattleFront2.jpg','images/theme/psp/VirtuaTennis.jpg','images/theme/psp/XMenLegends.jpg');
$alt_texts= array ('PSP Grand Theft Auto','PSP Grand Theft Auto','PSP NBA Live 2006','PSP Star Wars Battlefront 2','PSP Virtua Tennis','PSP X Men Lengends 2');
$links= array('http://gamefuse.com.au/product_info.php?products_id=30','http://gamefuse.com.au/product_info.php?products_id=30','http://gamefuse.com.au/product_info.php?products_id=79','http://gamefuse.com.au/product_info.php?products_id=47','http://gamefuse.com.au/product_info.php?products_id=86','http://gamefuse.com.au/product_info.php?products_id=72'); /* e.g. 'http://www.yoursite.com' */
$border="0";
$target="_blank";
$width="120";
$height="160";
$action="";// for javascript enter 'js' else leave empty.
// YOU DO NOT NEED TO MODIFY BELOW
$random_no= count($banners);
$random=$random_no-1;
mt_srand ((double) microtime () * 1000000);
$rnd= mt_rand(0,$random);
$banner=$banners[$rnd];
$alt_text=$alt_texts[$rnd];
$link=$links[$rnd];
if ($action=="js")
{
echo("document.write('<a href=\"$link\" target=\"$target\"><img src=\"$banner\" border=\"$border\" width=\"$width\" height=\"$height\" alt=\"$alt_text\"></a>');");
}
else
{
echo"<a href=\"$link\" target=\"$target\"><img src=\"$banner\" border=\"$border\" width=\"$width\" height=\"$height\" alt=\"$alt_text\"></a>";
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]