【发布时间】:2011-12-23 19:12:46
【问题描述】:
我知道,iframe,什么是 PITA!
Anyhoos,它们可以满足我的需求,它们只是一个主显示框架和一个隐藏的侧框架,其中包含可以随时调用的应用程序。
代码如下:
<html>
<head>
<!--Main Style-->
<link rel="stylesheet" type="text/css" href="site/css/main.css" />
<!--JQuery-->
<script type="text/javascript" src="site/scripts/jquery.js"></script>
<!--BG Colour, Hide Scrollbar and Margins-->
<body bgcolor="cc6666" style="overflow: hidden" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<!--Page Table, Contains Everything To Keep From Cutting Off iFrame-->
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0">
<!--iFrame Cell-->
<td height="100%">
<!--Main Frame-->
<!--Main frame loads last visited page based on user, unless not logged in then loads welcome page-->
<?php
if(isset($_SESSION['last_visited'])) {
print('<iframe name="frame" src="'.$_SESSION['last_visited'].'" width="100%" height="100%" frameborder="0" style="bgcolor:white;"></iframe>');
}
else {
print('<iframe name="frame" src="site/welcome.php" width="100%" height="100%" frameborder="0"></iframe>');
}
?>
<!--App Frame-->
<!--App frame will be initiated if no user is logged in, or if a user with apps turned on is logged in-->
<?php
if(isset($_SESSION['SESS_APPS'])) {
if($_SESSION['SESS_APPS'] == '1') {
print('<iframe id="app_frame" src="site/apps.php" width="0%" height="100%" frameborder="0" scrolling="no"></iframe>');
}
}
else {
print('<iframe id="app_frame" src="site/apps.php" width="0%" height="100%" frameborder="0" scrolling="no"></iframe>');
}
?>
<!--End iFrame Cell-->
</td>
<!--End Page Table-->
</table>
</body>
希望这不是太糟糕,但错误似乎肯定发生在底部附近,您使用 php.ini 打印了两个 iframe。如果我完全删除“应用程序框架”,则该页面是完美的,正如我在 IE 中测试的那样,但如果它打印 iframe,那么由于某种原因,它会在主框架下方打印它,而不是在右侧。
这仅在 Chrome 和 Safari 中发生,并且假设它必须是 WebKit 的东西,因为 Firefox 和 IE 并排打印帧,正如您所期望的那样。
我开始相信,html 是从左到右工作的,除非有某种中断,它会下降到下一行。
我认为在这种情况下不会发生这种情况的唯一原因是主单元格的宽度为 100%,这意味着它右侧的 antyhing 被推到下面的行中。
任何人都可以建议一种方法,我可以从 IE 中镜像 Chrome 和 Safari 的渲染吗?
注意:我不认为它对这么远的页面有任何影响,但整个页面是一个表,分为两行。第一行是一个表格,控制着我的标题的布局。第二行是另一个表格,控制框架的布局。
这是因为它允许页面根据用户的分辨率动态调整,从而调整窗口大小。
【问题讨论】:
-
如果不出意外,您的表格无效 - 它缺少行
<tr>标记。而且您缺少结束</head>和</html>标记。首先确保您的 html 是有效的,然后再将其他问题归咎于浏览器错误。 -
抱歉,这实际上是因为我选择了整个页面的一部分,因为我不想发布整个内容,因为它很大。我可以向您保证,表格和头部标签都可以。
标签: php html google-chrome iframe safari