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

Iframe targeting

Status
Not open for further replies.

jjs112674

IS-IT--Management
Feb 12, 2003
1
IE
I ma trying to get a link from my homepage that does not have an iframe to open one of many speciffic page in anouther page that has an iframe. It is as I have a parent iframes page for a whole series of sub pages that are supposed to load into the parent pages iframe. This works just fine off of the iframes page for all of the same links. It is only off of the Main page that I can not get this to work. I have tried something like this but it does not work.

<a href="subdoc.htm" target="iframespage.htm#iframe">

this is writen on the main page and not on the Iframes page. I am sure I am missing something.
 
Do you only have the one window open? Or do you have two? If you had two (and one is opened from the other), then you could use the "window.opener" property, and reference the iframe through that.

However, if you only have one window, you will need to pass the information through either a:
A) cookie
B) query string

Code:
<a href="iframespage.htm?frame=iframename&page=subdoc.htm">

Then in the "iframespage.htm" webpage, have some parsing function to read off the variables from the query string.

Hmmm... after looking at my "code" (above), I'm guessing you want to have two pages. Therefore you might like to try something like:
Code:
>> in mainpage
<script type="text/javascript">
// create a new window and get a handle on it
var winHandle=window.open(...);
...
function View(docname,framename) {
// check the winHandle object before calling
winHandle.viewPage(doc,frameName);
}
</script>
...
<a href="javascript:View('subdoc.htm','iframe');">

>> in iframespage.htm
<script type="text/javascript">
function viewPage(doc,frameName) {
	document.frames[frameName].location.href=doc;
}
</script>

Hope this helps.

Pete.


Web Developer & Aptrix / IBM Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top