View Full Version : iframe links


squalls_dreams
03-21-2005, 01:45 PM
hello I made an iframe that links to a random image script..and when I click on the image inside the iframe the site appears inside the iframe...how can I get it so the page opens in a new window?

pb&j
03-21-2005, 02:04 PM
in the link tag for the image, it should look kinda like this...

<a href="..."> <img src="..."> </a>

to make the image open into a new window, add the target piece like this...

<a href="..." target="_blank"> <img src="..."> </a>

squalls_dreams
03-23-2005, 01:14 PM
I dunno if I can do that cuz I am usin a random image script for the lil banners...this is the code for it.

<html>
<head>
<SCRIPT language="JavaScript">
<!--
/* You can get this script and many others
by visiting JavaScript City at: http://www.javascriptcity.com . */

pic_width=88; /*change to match the height of all your images */
pic_height=31; /* change to match the width of all your images */
border_size=0; /* change to the border size you want on the images */
alignment=0; /* 0=left,1=center */

/* define image urls */

if (document.images)
{
pic1= new Image(pic_width,pic_height);
pic1.src="http://www.hellandheavennet.com/button2.gif";
pic2= new Image(pic_width,pic_height);
pic2.src="http://www.ffsphere.com/links/ani_10.gif";
pic3= new Image(pic_width,pic_height);
pic3.src="http://www2.chaotic-system.net:9000/ffr/images/link08.jpg";
pic4= new Image(pic_width,pic_height);
pic4.src="file://Server/joh_fis/my%20second%20webpage/ffls.gif";
pic5= new Image(pic_width,pic_height);
pic5.src="http://ffgaming.com/button.gif";
}

/* define banner urls */

urlad1="http://www.hellandheavennet.com";
urlad2="http://www.fflostsouls.net";
urlad3="http://www2.chaotic-system.net";
urlad4="http://www.fflostsouls.net";
urlad5="http://ffgaming.com/";

/* no need to edit past this point (unless you want to add more image and url slots) */

if (alignment==1)
{
cent_it="<CENTER>";
cent_it2="<\/CENTER>";
}
else
{
cent_it="";
cent_it2="";
}

function get_random(maxNum)
{
if (Math.random && Math.round)
{
var ranNum= Math.round(Math.random()*(maxNum-1));
ranNum+=1;
return ranNum;
}
else
{
today= new Date();
hours= today.getHours();
mins= today.getMinutes();
secn= today.getSeconds();
if (hours==19)
hours=18;
var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1;
return ranNum;
}
}

function get_Image()
{
if (document.images)
{
var choose_one= get_random(5);
choose_one--;

var pics= new Array(5)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;

var aurl= new Array(5)
aurl[0]=urlad1;
aurl[1]=urlad2;
aurl[2]=urlad3;
aurl[3]=urlad4;
aurl[4]=urlad5;

document.write(cent_it+"<A HREF='"+aurl[choose_one]+"'><IMG SRC='"+pics[choose_one]+"' width='"+pic_width+"' height='"+pic_height+"' border='"+border_size+"'></A>"+cent_it2);
}
}
//-->
</SCRIPT>
</head>
<title>FFLostSouls Network</title>
<body>
<SCRIPT language="JavaScript">
<!--
get_Image()
//-->
</SCRIPT>
</body>
</html>


do u know how I can fix this so that I can open up the sites in a different window still?

pb&j
03-23-2005, 01:32 PM
document.write(cent_it+"<A HREF='"+aurl[choose_one]+"' target='_blank'><IMG SRC='"+pics[choose_one]+"' width='"+pic_width+"' height='"+pic_height+"' border='"+border_size+"'></A>"+cent_it2);

(using single quotes)

squalls_dreams
03-23-2005, 01:52 PM
right on thanks a bunch..it works

pb&j
03-23-2005, 03:27 PM
no worries. good luck!