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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open iframed link in parent window.....

Status
Not open for further replies.

budgy

Programmer
Jan 4, 2005
73
0
0
GB
Hi guys I really hope you can help me out here, the line of coding which I have highlighted is what I want to open up in a parent window. This bit of coding is iframed and at the moment, when the image is clicked the content is opening up within the constraints of the iframe,... i believe there is a .. parent.location.href" script i could use, but im not entirely sure how to impliment this... could anyone shed any light on this for me....

Thanks in advance [thumbsup]

Code:
<script language="JavaScript">
<!--
var imgs = new Array("home/images/bulletin/cheif_awards/cheifawards.jpg")//,"home/images/bulletin/cheif_awards/cheifawards.jpg")//,"home/images/bulletin/Interim_Results/Chain_images.gif","home/images/bulletin/Interim_Results/Euro_images_lrg.gif");
var alt = new Array("Chief Executive Awards for 2005-2006")//,"****","****","******");
[highlight]var links = new Array ("[URL unfurl="true"]http://*******.co.uk/HeadOffice/Frontline/English_Stories/2006/jan/chief.html")[/URL] [/highlight]//,"[URL unfurl="true"]http://******/HeadOffice/Frontline/English_Stories/2006/jan/InterimResults.htm","http://******/HeadOffice/Frontline/English_Stories/2006/jan/InterimResults.htm","http://******/HeadOffice/Frontline/English_Stories/2006/jan/InterimResults.htm");[/URL]
var width='275';var height='185';var loop=1;var time='7000';
if (document.images) {var cache = new Array(); for (i=0;i<imgs.length;i++) {cache[i] = new Image();cache[i].src = imgs[i];}}
var ie4 = document.all; var dom = document.getElementById;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1); var isOpera7 = (navigator.userAgent.indexOf("Opera 7.") != -1);
var ok = ((ie4||dom) && (!(isOpera && !isOpera7)))?true:false;
var current_canvas = "canvas0"; var current_index = 0; var next_index = 1;
function rotate() {
	temp = ie4?eval("document.all."+current_canvas):document.getElementById(current_canvas);
	temp.style.zIndex++;
	current_opacity = 11;
	interval = eval('setInterval("fade()",50)');
}
function fade() {
	if (current_opacity<89) {
		current_opacity+=11;
		setOpacity(current_canvas,current_opacity);
		}
	//else {
		//clearInterval(interval);
		//current_canvas = (current_canvas=="canvas0")?"canvas1":"canvas0";
		//next_canvas = (current_canvas=="canvas0")?"canvas0":"canvas1";
		//setOpacity(next_canvas,11);
		//next_canvas_obj = ie4?eval("document.all." + next_canvas):document.getElementById(next_canvas);
		//next_canvas_obj.innerHTML = '<a href="'+links[next_index]+'"><img src="'+imgs[next_index]+'" alt="'+alt[next_index]+'" border="0" width="'+width+'" height="'+height+'" /></a>';
		//next_index = (next_index<imgs.length-1)?next_index+1:0;
		//if ((loop==0) && (next_index==0)){return false;}
		//setTimeout("rotate()",time);
	//}
}
function setOpacity(which,num) {
	var obj = ie4?eval("document.all."+which):document.getElementById(which);
	if (obj.filters) {obj.filters.alpha.opacity=num;}
	if (obj.style.MozOpacity) {obj.style.MozOpacity=num/100;}
	if (obj.style.opacity) {obj.style.opacity=num/100;}
	if (obj.style.setProperty) {obj.style.setProperty('-khtml-opacity',num/100,null);}
}
// -->
</script>
        <table width="483" cellpadding="0" cellspacing="0" border="0" class="grbg">
          <tr>
            <td height="185" valign="top"><script language="JavaScript">
<!--
if (ok) {document.write('<div style="margin:0;position:relative;width:'+width+';height:'+height+';overflow:hidden"><div id="canvas0" style="margin:0;position:absolute;width:'+width+';height:'+height+';top:0;left:0;filter:alpha(opacity=11);-moz-opacity:.11;opacity:.11;-khtml-opacity:.11;"><a href="'+links[current_index]+'"><img src="'+imgs[current_index]+'" alt="'+alt[current_index]+'" border="0" width="'+width+'" height="'+height+'" /></a></div><div id="canvas1" style="margin:0;position:absolute;width:'+width+';height:'+height+';top:0;left:0;filter:alpha(opacity=11);-moz-opacity:.11;opacity:.11;-khtml-opacity:.11;"></div></div>');rotate();}
else {document.write('<a href="'+links[0]+'"><img name="defaultslide" src="'+imgs[0]+'" alt="'+alt[0]+'" border="0" width="'+width+'" height="'+height+'" /></a>');}
// -->
  </script>

[2thumbsup]

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
Try a minor edit to the following (near the end of the code you pasted):
Code:
<a href="'+links[current_index]+'">
And add in:
Code:
<a href="'+links[current_index]+'"[!] target="top"[/!]>
That ought to give you an immediate solution.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
BabyJeffy - Your a legand [peace][thumbsup2]

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top