Targeting Frame Content

liunx

Guest
I'm trying to create a link that opens a frameset page, but opens a specified page (other than what normally appears) within the main content frame.<br />
<br />
For example: Let's say my index page is a frameset containing 2 frames, one is the Leftbar frame and the other is the MainContent frame. The MainContent frame is set to load a welcome page when linking normally. However, I want to create a link from another site to open the index page, but load, let's say, a What'sNew page within the MainContent frame.<br />
<br />
How do I accomplish this in an html link?<br />
<br />
Thanks.<!--content-->Take a look at this thread:<br />
<br />
<!-- m --><a class="postlink" href="http://forums.webdeveloper.com/showthread.php?s=&threadid=2111">http://forums.webdeveloper.com/showthre ... eadid=2111</a><!-- m --><!--content-->Or, here's a JavaScript method.<br />
<br />
First change your index page to the code below. What it will do is set homepage.html to be the page *** ou didn't specify a different page, or if you did (by specifing a ? in the a href [see below]) I have commented the code so you can see what is happening.<br />
<br />
<script type="text/javascript"><br />
<!--Hide<br />
linkURL = "homepage.html" //set the default URL to load if there was no referrer<br />
if (top.location.href) { //to be compatible with IE use top.location.href instead of parent.document.URL<br />
pageURL = top.location.href //set the top.location.href to parentURL<br />
if (pageURL.indexOf('?') != -1) { //Check for the referring page<br />
linkURL = pageURL.substring (pageURL.indexOf('?')+1, pageURL.length) //parse the top.location.href to remove everything before the ?<br />
}<br />
}<br />
<br />
document.write('<FRAMESET ROWS="67,*,35" Border=0>')<br />
document.write('<FRAME SCROLLING=NO NORESIZE SRC=http://www.webdeveloper.com/forum/archive/index.php/"top.html" NAME="top">')<br />
document.write('<FRAME NORESIZE SRC=http://www.webdeveloper.com/forum/archive/index.php/"' + linkURL + '" NAME="homepage">') //this is the frame that the content is loaded into<br />
document.write('<FRAME SCROLLING=NO NORESIZE SRC=http://www.webdeveloper.com/forum/archive/index.php/"address.html" NAME="address">')<br />
document.write('<\/FRAMESET>')<br />
<br />
//End hide--><br />
</script><br />
<br />
Then, use this link to force your page into the content cell, where yourpage.html is the page you want in the frameset.<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"index.html?yourpage.html">Force page into frameset</a><!--content-->Pyro, that works, but what would you do when sometimes want the topframe and sometime the bottomframe to change?<!--content-->Originally posted by swon <br />
Pyro, that works, but what would you do when sometimes want the topframe and sometime the bottomframe to change? When I wrote that code, I didn't need to be able to do that. If there sever has PHP enabled, yours is the better way. :D<!--content-->Pyro, by the way:<br />
<br />
I saw that your preferred prog language is PHP like mine too, my question to you (cause here's no phpforum):<br />
<br />
Do you have any sources for creating pdf files with php, I've found a few, but when I try to create a pdf files from a phpfile which contains tables, I can't get it to work. Any ideas?<!--content-->Yup, my preferred scripting language is PHP. Gotta love PHP. :D<br />
<br />
I've not had the need to make a pdf file in PHP, yet, so I don't know a whole lot about that aspect of it. Sorry, wish I could help you. Maybe I can... Head over to <!-- m --><a class="postlink" href="http://www.phpbuilder.com">http://www.phpbuilder.com</a><!-- m --> -- there is an excellent PHP forums over there. (over 35,000 registerd users!) That's where I hang out for my PHP needs. :)<!--content-->Okay, thanks a lot pyro!<!--content-->Originally posted by pyro <br />
First change your index page to the code below. What it will do is set homepage.html to be the page *** ou didn't specify a different page, or if you did <br />
<br />
<br />
It will also prevent at least 10-15% of the visitors from ever reaching the site.<br />
<br />
Where is the backup for when JS is not available?<br />
<br />
This is definitly something that should be done serverside instead of relying on clientside scripting.<br />
If serverside languages are NOT available I would recomend providing an entire frameset for each specific link to mimimize the risk of the entire site breaking compleatly.<!--content-->Or, go ahead a specify a <noscript> frameset.<!--content-->Originally posted by pyro <br />
Or, go ahead a specify a <noscript> frameset. <br />
<br />
It's a lot better as it won't leave an empty white page for a visitor, but it only partially works in this case.<br />
The URL refering will still fail without JS, so the visitor will get to the wrong page.<br />
<br />
To do this reliably you need <br />
a) serverside scripting<br />
or<br />
b) manually provide a frameset for each single page in frame name="main".<!--content-->
 
Back
Top