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!

Link to open in parent window?

Status
Not open for further replies.

budgy

Programmer
Jan 4, 2005
73
0
0
GB
Hopefully there is a easy solution to this problem...

I want the link in this bit of coding to open in the parent window. Thanks

<script language="JavaScript">
<!--
var imgs = new Array("home/images/bulletin/cheif_awards/cheifawards.jpg")
var alt = new Array("Chief Executive Awards for 2005-2006")
var links = new Array ("
Thanks in advance!!

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
Try setting the parent's url via parent.location.href


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
ca8msm could you please perhaps expand on that?.. how would i go about doing that?...

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
parent.location.href="

____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
hey thanks ca8msn, i tried doing that....but when ever tht bit of coding is entered the page automatically loads to that link, without anything being pressed.... :S is there a way a round this perhaps?

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
You asked how to open the parent window to a particular url and that's what it does. I don't understand why you now don't want that to happen?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
ca8sms so sorry for the misunderstanding, i would like that link to open up when the picture it is attached to is clicked, at the moment when the page loads up, with ur piece of coding it, it just goes stright through to the link.

Once again my apologies for the confusion. i appreciate your guildence.:)

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
So when you say "parent" do you actually mean a new browser window?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
... when i say parent i mean i want that link, when clicked on to open up on the current window, not a new browser window. What i have done is iframed this bit of coding which involves the rotation of some images and text into the main default page. The problem is that when a link is clicked from this iframed page, the link opens up within the constraints of the iframe , rather than opening up on the whole page, which is what i want.. I hope this makes it clearer...

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
How about you post a URL. We cannot go any further with this problem until you show us your [!]client-side source code[/!] preferably a URL to the page so we can see ALL the different things that could be interacting with it.

The questions you are asking are fine - but you are not providing us with the information we require to solve this problem. You will (at the very least) need to show us the javascript code that builds these URLs from the array variables you have provided.

Cheers,
Jeff

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

What is Javascript? FAQ216-6094
 
In the IMG tag in the IFRAME, include on ONCLICK event that calls a function (also in the IFRAME page).

In the function, include ca8msm's suggestion and you should be set.

This is just one way. Let us know if you need expansion on any of these points.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Dave, could you give me a expansion please, i understand that a onclick event would help, but im not sure how i would impliment it.

This is how my iframe link looks :

<IFRAME NAME="linkframe" SRC="main_story.htm" WIDTH="488" HEIGHT="185" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0" scrolling="no"></IFRAME>



"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
Somewhere in the HTML of the page that is in your IFRAME, you have something like:

<img src='myImg.gif' />

...and you're interesting in clicking on that and getting a reaction. So add the ONCLICK event by:

<img src='myImg.gif' [red]onclick='loadUrlInParent()'[/red] />

...where 'loadUrlInParent()' is an arbitrarily named function that you will write and stick in the HEAD section of the same page.

In that function , use ca8msm's suggestion for loading the URL in the parent.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top