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!

How can I open my page within a frameset...

Status
Not open for further replies.

martindavey

Programmer
Jan 2, 2000
122
GB
I have a frameset with 2 columns:
25% = FRAME1 = contents.htm
75% = FRAME2 = main.htm

When I click on a link in FRAME1 (eg page1.htm) it opens in FRAME2.

So far so good.

However, If someone opens page1.htm directly, I want the frameset to open, with page1.htm in FRAME2 (not main.htm).

How could I do that?
 
Hi, I don't know if it's possible without server-side script

So I did it once with ASP-script:

<%
'The user has to know that this is the url:
'
dim sPath

if Request.QueryString(&quot;path&quot;) <> &quot;&quot; then
sPath = server.HTMLEncode(Request.Querystring(&quot;path&quot;))
else
sPath = &quot;homepage/main.asp&quot;
end if
%>

<frameset framespacing=&quot;0&quot; frameborder=&quot;0&quot; border=&quot;false&quot; cols=&quot;150,650&quot;>
<frame src=&quot;contents.htm&quot; .....>
<frame src=&quot;<%=sPath%>&quot; .......>
</frameset>

Erik
 
if i understand what you are saying, then you do not want page1.htm to be viewed on its own - just within the frame...

i had a site once where i applied this concept - with a simple javascript - only it reloaded the main.htm back into mainFrame instead of page1.htm - i figured if the person went to the trouble of typing the url to page1.htm in the address bar, then they can take the time to renavigate to page1.htm - here is the script i used:

<script language=&quot;JavaScript&quot;>
<!--
{if (self.location==parent.location) parent.location='index.htm'}
// -->
</script>

index.htm had the frameset that called content.htm and main.htm - you can probably modify the script and add a variable somewhere to make it call page1.htm, page2.htm, etc. into the mainFrame instead of main.htm - but - if a person has javascript disabled then i guess none of this matters!!!

hope this is helpful in any way

- milech LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top