November 17, 200916 yr Hi, This is probably quite simple. What I have is a frameset page with two frames, a top frame and a main frame beneath it. It is going to be used to preview websites. On the main page with the websites listed I want to have links for these websites open in the frameset page and then open the specific website in the mainframe without having to have a seperate frame set for each website. I.e Website 1 Link - User would click this link and it would open the frameset page and load Website 1 in the main frame. I think this explains clear enough. Anyone know how this is done?
November 17, 200916 yr In the frameset file you give any frame you want to link to a name:- <frame src="framesetcontent.html" name="maincontent"> then in the frame which has the links you use target="..." and name the target frame:- You target a frame with a name using target="maincontent" if the frame code in the frameset file has name="maincontent". Although HTML/XHTML normally requires "id" to be used instead of "name"; in this instance "id" does not work so "name" must be used. This link opens in the maincontent frame (and creates scrollbars if necessary) because the code is:- <a href="page2.html" target="maincontent">Page 2 link</a> See http://www.wickham43.net/framesets.php You can use the same target for all the links so they all open in the same frame. Use a framesets doctype.
November 17, 200916 yr Author My bad, I didn't explain clearly enough. The links to the frame set are on a seperate page completely. Not within the frameset.
November 18, 200916 yr I've thought about it, but I don't know a solution. You want the link from another page to open a frameset - simple - but the page in the main frame has to change depending on which the link is clicked on the other page. The frameset sets the initial page for the main frame, so some language like PHP or javascript would have to take an instruction to change the url in the frame inside the frameset. It's obviously simpler to set up different frameset pages with different link urls in the other page. You could simplify it by using PHP "includes". You would have different links in the other web page to page1.php, page2.php, etc. but they would be frameset pages. Page1.php and page2.php would have PHP "include" files for the common frameset code before the frame code <frame src="page2.html" name="maincontent"> and then another "include" for the frameset code after the frame code but this isn't any different from setting up several different frameset files.
Create an account or sign in to comment