简体   繁体   中英

HTML Frameset: Frameset Open in new tab/window

I was thinking this since last week how to solve my problem using the frameset.

Scenario:

I have a html file for header, footer, menu, and content with there own background color. I used the frameset for better design.

Background color of my header is black, for footer is also black, menu is gray and content just plain white.

Everything works perfectly but I saw a problem in menu , when the user click the home page using the Open Link in New Tab or Open Link in New Window the design for home page is just only white.

Question:

Is there a way that when the user click the link using Open Link in New Tab or Open Link in New Window the background color of the four html file will also included?

Here's my code for frameset:

<frameset rows="120,*,30" border ="0">
<frame name ="top" src="header.php">

</frame>

<frameset cols="200,*" border ="0">
<frame src="menu_viewer.php" name="menu">
<frame src="index.php" name="main" scrolling="yes">
</frame>
</frameset>

<frame name="bottom" src="footer.php">

</frameset>

Here's a printscreen of my design:

在此处输入图片说明

And when the user click Open Link in New Tab or Open Link in New Window the result is

在此处输入图片说明

The correct result should be:

在此处输入图片说明

Any suggestions or recommend program as long as the result of the design is like that is also welcome. Advance thank you.

@ Princess Toledo: framesets are now not supported in HTML5. and if u do it in css then use a wrapper to your code ie

<body>
<div id=wrapper>
<!-- your code -->
</div>
</body>

and give css to wrapper as

#wrapper {
  width:980px;
  margin: auto;
 }

this wil keep your content fit inside the wrapper and at center of the page and wil not collapse in high resolution window.

if your frameset file is named frameset.php, you can modify it this way

 <frameset rows="120,*,30" border ="0"> <frame name ="top" src="header.php"> </frame> <frameset cols="200,*" border ="0"> <frame src="menu_viewer.php" name="menu"> <?php if (isset($_GET['main'])): ?> <frame src="<?php echo $_GET['main']; ?>" name="main" scrolling="yes"> <?php else: ?> <frame src="index.php" name="main" scrolling="yes"> <?php endif; ?> </frame> </frameset> <frame name="bottom" src="footer.php"> </frameset> 

And then to each of your page file, insert a little top frame checking. For example, to the file index.php, insert this code:

 <script> if(self==top){ self.location = "frameset.php?main=index.php"; } </script> 

And to the file playlist.php, insert this code :

 <script> if(self==top){ self.location = 'frameset.php?main=playlist.php'; } </script> 

And so on to the rest of your page files.

I hope you get the idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM