平常我个人开发页面时,一般用width都是100%的,所以用frameset起来就没有什么问题,后来由于某些原因需要将宽度设为1024,糟了,frameset设定style都不起作用了!
后来通过在网上查找,终于得到了答案,现将代码贴出来,希望有助于大家。
一种方法是使用table+iframe,但是做起来还比较麻烦,如果在我们已有的frameset中加工呢?呵呵,如下:
原先代码如下:
<frameset rows="140,*" border="0" frameborder="no">
<frame src="header.jsp" frameborder="0" name="i_top" scrolling="no" noresize>
<frame src="${ctx }/welcome/welcome.html" frameborder="no" name="i_body" scrolling="auto" >
</frameset>
这样默认应该是width 100%的,现在要限制为1024,只需要几行代码,如下:
<frameset cols="*,1024,*" bordercolor="gray">
<frame src="about:blank"></frame>
<frameset rows="140,*" border="0" frameborder="no">
<frame src="header.jsp" frameborder="0" name="i_top" scrolling="no" noresize>
<frame src="${ctx }/welcome/welcome.html" frameborder="no" name="i_body" scrolling="auto" >
</frameset>
<frame src="about:blank"></frame>
</frameset>
当然这里的about:blank可以换成其他的链接。
呵呵,现在再看看,是不是固定宽度了?如果你的分辨率是1024*768的话可能看不出效果,调高分辨率后效果就出来了!