Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Banner Rotator Script - Need Target="_blank" inserted? 1

Status
Not open for further replies.

jwkolker

Programmer
Jan 9, 2003
68
US
Hello - this script works well but I can't for the life of me figure out where to insert target="_blank" so that the url direct will pop a new window and the visitors won't leave my site after clicking on my advertisers banner...
The link where this script works is


(reload page to see the banner rotate)

The code that needs target="_blank" inserted (and I don't know where)

Code:
#!/usr/bin/perl
$|=1;
$mypic[0]="/personals/banners/AdKlix_468_MenuBanner.gif WIDTH=468 HEIGHT=60 border=0";
$myurl[0]="[URL unfurl="true"]http://www.cnn.com";[/URL]
$mypic[1]="/personals/banners/addesign.gif WIDTH=468 HEIGHT=60 border=0";
$myurl[1]="[URL unfurl="true"]http://www.foxnews.com";[/URL]
$mypic[2]="/personals/banners/gotcomp.gif WIDTH=468 HEIGHT=60 border=0";
$myurl[2]="[URL unfurl="true"]http://www.home2work.com";[/URL]
$mypic[3]="/personals/banners/Hand_Subtle_Ban.gif WIDTH=468 HEIGHT=60 border=0";
$myurl[3]="[URL unfurl="true"]http://www.adklix.com";[/URL]
srand(time ^ $$);
$pick = rand(@mypic);
print "Content-type: text/html\n\n";
print &quot;<A HREF=\&quot;$myurl[$pick]\&quot;><IMG SRC=$mypic[$pick]></A>&quot;;

Thank you.

John Kolker


John Kolker
Programmer
jwkolker@comcast.net
 
Have you tried:

print &quot;<A HREF=\&quot;$myurl[$pick]\&quot; target=\&quot;_blank\&quot;><IMG SRC=$mypic[$pick]></a>&quot;;

- or the more readble version -

print qq(<A HREF=&quot;$myurl[$pick]&quot; target=&quot;_blank&quot;><IMG SRC=$mypic[$pick]></a>&quot;);
 
ick, I've had so many problems with escaping quotes I find it so much easier and cleaner to type and debug to use:

print qq(...oh wait, usige already came up with it :( Darn, I never get to help anyone :( lol

&quot;Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
 
This is the final clean version:
I have it running at
Code:
#!/usr/bin/perl
$|=1;
$mypic[0]=&quot;/personals/banners/AdKlix_468_MenuBanner.gif WIDTH=468 HEIGHT=60 border=0 alt=\&quot;First Banner\&quot;&quot;;
$myurl[0]=&quot;[URL unfurl="true"]http://www.cnn.com&quot;;[/URL]
$mypic[1]=&quot;/personals/banners/addesign.gif WIDTH=468 HEIGHT=60 border=0 alt=\&quot;Second Banner\&quot;&quot;;
$myurl[1]=&quot;[URL unfurl="true"]http://www.foxnews.com&quot;;[/URL]
$mypic[2]=&quot;/personals/banners/gotcomp.gif WIDTH=468 HEIGHT=60 border=0 alt=\&quot;Third Banner\&quot;&quot;;
$myurl[2]=&quot;[URL unfurl="true"]http://www.home2work.com&quot;;[/URL]
$mypic[3]=&quot;/personals/banners/Hand_Subtle_Ban.gif WIDTH=468 HEIGHT=60 border=0 alt=\&quot;Fourth Banner\&quot;&quot;;
$myurl[3]=&quot;[URL unfurl="true"]http://www.adklix.com&quot;;[/URL]
srand(time ^ $$);
$pick = rand(@mypic);
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<A HREF=\&quot;$myurl[$pick]\&quot; target=\&quot;_blank\&quot;><IMG SRC=$mypic[$pick]></a>&quot;;

John Kolker
Programmer
jwkolker@comcast.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top