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

Open a window with frames and direct different pages to one frame

Status
Not open for further replies.

niblet

Programmer
Aug 7, 2001
30
US
Hi .

I have a frameset in diagnosis page defined like this

<frameset rows=&quot;200,*&quot; cols=&quot;*&quot;>
<frame name=&quot;banner&quot; src=&quot;symptomheader.htm&quot;>
<frame name=&quot;description&quot; src=&quot;diagnosis.htm&quot; >
</frameset>

from a symptoms page I would like to open a window to this
diagnosis frame set and depending on which button is pressed in the symptoms have a different page appear in the description instead of the diagnosis.htm page.

my guess which has been a theme and variation on this

from the parent page.

onClick=window.open(&quot;diagnosis.frame[decription].location.href='anewpagebesidesdiagnosis.htm'&quot;)

I am just guessing though. I don't even know if this is possible.

thanks


 
(1)

IN the frameset you want to put the links in, click window/frames, then window/property manger

Click on the frame you want to change the info in(in the fames box), then in the property manger give the frame a name, say for example.&quot;mainframe&quot;


(2)
Make a new document
Add the new data
save

(3)

Go back to your original framset
Clcik on the relevant button
Using the propety manger, create a link to the new document
IN the target boc, choose&quot;mainframe&quot;

Now when you click on the button, the new document with the enw daa will open up in the &quot;mainframe&quot;

 
Hi Nippi,

Actually, that made the right page come up, but not in the frame page, in an new page all by itself. I need the top frame with the info banner to come up as well. I have used that tac before, but for when the frames were on the same page as the button, Here the button is on a different page, than the frames.

there are 3 buttons on the parent page. b1, b2, b3

there are two frames on the child page. f1 = a banner
f2 = b1.htm when b1 is pressed on parent page, b2.htm when b2 is pressed on parent page, and b3.htm when b3 is clicked on parent page. does that make sense ?

doing it my way with the open browser window form the behavior panel brings up the two frame child page but with the src that was originally written as src when the frames were defined, not the page based on the button pressed in parent.

doing it with your suggestion, makes a new window pop up, but a full featured browser window, without the banner frame on top, but it had the right document, based on the button press. So somewhere in between us is what I'm looking for. Do you understand what I'm asking?

I appreciate the help, I think you have helped me before a few months back.

thanks
niblet


 
I'm guessing you ahven't named the frame, or targeted it correctly.

Click window/frames
Click window/property manger
Click on the relevant frame in the frames box.
Checkout the porperty manger.

Now. The frame name is in the box on the far left of the property manager. Ignore the document name that appears in the box top/middle of property manger. This is nothing to do with your frame name, this is the name of the file that appears in the frame, when the aprent frameset is first opened.

Make sure you have given the frame a name, say &quot;mainframe&quot;

When you add your link to your buttons, the target should then be &quot;mainframe. If youa re not getting this option, its because.
(1) You still ahven't name di tproperly
(2) You aren't do the linking with the aprent frameset open, youa re doing it with only the file with the buttons in it open.

Its a bit confusing, might be easier to post your site and let me look at it, copy your code where it eneds fixing and mail it to you.

 
Hi,

I have sort of solved it, I have a script now that tests for the presense of frames when the page is called from the href, and if the frame is not present, it opens the frames page and puts the correct page in the frames.

This is working, for what I wanted it to do. The code works on a the onload, so the page loads all the way first and I don't like that, but at least it works.

I could not make nippi's suggestion work. Everything nippi said was right, the name of the frame was on the left side of the property manager, I had both pages open, the frames were presented as targets for the page with the frames, and even with that frame page open concurrently with the button page, I could not see those frames as target from the button page.

I will post the pages so I can show nippi what I meant, I just wasn't able to do that yesterday, as I had a couple of link problems as well. I'll let you know when its up.

Meanwhile here is the code that I used in the parent and child pages to open the pages based on the button press.

in the child pages

function detect()
{
framesetpage=&quot;symptomframeset.htm&quot;;
thispage=window.location.href;
if (thispage.indexOf('://')<0)
{
thispage=&quot;://&quot;+thispage;
};
prefix=thispage.substring(0,thispage.lastIndexOf('://'));
suffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
// alert('the subpage is:['+prefix+']['+suffix+']');
if (parent.location.href==window.location.href)
{
parent.location.href=framesetpage+&quot;?&quot;+prefix+&quot;&&&&quot;+suffix
};
}

and rewrote the frame page like this

<HTML>
<HEAD>
<TITLE>Symptom Frames Page</TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
defaultsubpage=&quot;anorexia.htm&quot;;
if (location.search)
{
subpage=location.search.substring(1)
}
else
{
subpage=defaultsubpage
}

if (subpage.indexOf('&&&')>=0)
{
prefix=subpage.substring(0,subpage.indexOf('&&&'))+&quot;://&quot;;
suffix=subpage.substring(subpage.indexOf('&&&')+3,subpage.length);
subpage=prefix+suffix;
}
// -->
</SCRIPT>
</HEAD>


<SCRIPT>
document.write('<FRAMESET ROWS=&quot;175,*&quot; COLS=&quot;*&quot; FRAMEBORDER=&quot;no&quot; BORDER=&quot;0&quot; FRAMESPACING=&quot;0&quot;>');
document.write('<FRAME NAME=&quot;banner&quot; SCROLLING=&quot;NO&quot; SRC=&quot;symptomsheader.htm&quot;>');
document.write('<FRAME SRC=&quot;'+subpage+'&quot; NAME=&quot;symptom&quot;>');
document.write('</FRAMESET>');
</SCRIPT>

</HTML>



and from the button page I just used an href to the child page and the child page does the work of assuring the frames get loaded. This at least works, its just not very efficient. I was going to add another step to load a page that just has the script and not the graphic that causes a slower load in the child, but have not done that yet. Anyways. I will post the pages when I fix a couple of other link problems and then put the link here so you can look at it. I'm new to this end of development, Typically I do backend work, so i have no doubt there is a better way to do it ... I just needed to get a success and this worked. So I'll keep you posted.

thanks so much to nippi for your help and patience

details as they unfold ....
niblet









 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top