微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 两个框架一个滚动条

我正在尝试创建两个框架并使它们一起滚动,
例如,如果页面顶部有更改的菜单栏 –
我正在使用旋转木马 – 或底部的页脚,
必须作为页面的一部分出现.

我希望页面看起来像一个也能够滚动的页面,
页面实际上由两个框架组成.
用这个……

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<!-- Info from: http://www.webxpertz.net/forums/showthread.PHP?t=257 -->
<!-- Using this... -->

<Meta NAME="Description" content="Outer frame(OneBaredFrame) used to wrap the header and body frames" />
<Meta HTTP-EQUIV="Cache-Control" content="no-cache" />
<Meta HTTP-EQUIV="pragma" content="no-cache" />

<title></title>

</head>

<frameset rows="1,*" border="0" frameborder="no">

<frame src="javascript:<HTML></HTML>" name="dummy" id="dummy" 
frameborder="no" marginheight="0" marginwidth="0" noresize="noresize" scrolling="no"></frame>

<frame src="index_inner.html" name="OneBaredFrame"
 id="OneBaredFrame" frameborder="no" marginheight="0" marginwidth="0"  noresize="noresize" scrolling="yes"></frame>

<!-- the bottom frame above if scrolling="yes" doesn't show a scrollbar for me? -->

<!-- the top frame above if scrolling="yes" does show a scrollbar for me if rows="100,*" say? -->

</frameset>

</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">


<head>

<Meta NAME="Description" content="Frames for within a scrollable frame">

<Meta HTTP-EQUIV="Cache-Control" content="no-cache">

<Meta HTTP-EQUIV="pragma" content="no-cache">

<title></title>

</head>

 <!-- My header and body frames need to scroll together,so I am using another frameset (the one above) to enclose these frames -->

<frameset rows="215,*" border="0" frameborder="no"> 
<frame src="Header.html" id="header" name="header" frameborder="no"
 marginheight="0" marginwidth="0" noresize="noresize" scrolling="no"></frame>

<frame src="index_body.html" id ="body" name="body" frameborder="no" 
marginheight="0" marginwidth="0" noresize="noresize" scrolling="no"></frame>

<!-- when the above are set to scrolling="yes" scrollbars appear for me for each -->

</frameset>

</html>

解决方法

使用框架时,每个框架都会有自己的滚动条.

两个帧不能有一个滚动条,正是因为它是两个帧.

更新:

您可以通过使两个框架不滚动并将它们包装在第三个滚动框架内来解决这个问题(其唯一的存在理由是提供单个滚动条).父框架将处理两个内框架的滚动.

您需要添加一个带有如下框架集的新页面,确保第二个框架指向您的框架集(并在两个框架集上设置SCROLLING =“NO”:

<FRAMESET ROWS="0%,100%"
  BORDER="0"
  FRAMEBORDER="NO">
  <FRAME SRC=""
    NAME="dummy"
    FRAMEBORDER="NO"
    MARGINHEIGHT="0"
    MARGINWIDTH="0"
    norESIZE
    SCROLLING="NO">
  </FRAME>
  <FRAME SRC="*url to your frameset*"
    NAME="myframes"
    FRAMEBORDER="NO"
    MARGINHEIGHT="0"
    MARGINWIDTH="0"
    norESIZE
    SCROLLING="YES">
  </FRAME>
</FRAMESET>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。