iframe不能在IE中工作


iframe doesnt work in IE

我正在为摄影师建立一个网站,我使用iframe在网站中包含不同的图片作为一个长条的图片。这在chrome safari和firefox中工作良好,但似乎不工作在internet explorer?这是我使用iframe

的文件
<?php
include 'core/init.php';
include 'includes/overall/overalheader.php';
include 'includes/aside.php'; 
if (isset($_GET['id']) === true && empty($_GET['id']) === false) {
    $_SESSION['serie_id'] = $_GET['id'];
    $lengte = lengte_frame($_SESSION['serie_id']);
    ?>
    <iframe src="includes/fotos.php" frameborder="0" height="520px" width="<?php echo $lengte; ?>px"></iframe>
    <?php
}
else {
    echo 'hallee dermee';
}
 include 'includes/overall/overalfooter.php';?> 

这是fotos.php文件

<?php
include '../core/init.php';
$tekst = get_tekst($_SESSION['serie_id']);
$fotos = get_fotos($_SESSION['serie_id']);
?>

        <div width="135" style="float:left; padding-left:15; border:1; max-width:200"></div>
        <?php
        $count = 0;
        foreach ($fotos as $foto) {
            if ($count == 0) {
                $breed = 160;
            } else {
                $breed = 15;
            }
            echo '<div style="float:left; padding-left:' . $breed . '" width="' . $foto['width'] . '"><img src="../' . $foto['path'] . '" height="' . $foto['height'] . '" width="' . $foto['width'] . '"></div>';
            $count++;
        }
        if (empty($tekst) === false) {
       echo '<table style="float:left; padding-left:15;" width="200"><tr><td valign="top"><font face="Courier New, Courier, monospace" color="#777777" size="2px">' . $tekst . '</font><td><tr></table>';
        } 
        ?>

问题似乎是你为这些图像设置的高度。

查看其他浏览器中的源代码,图片(IMG标签)显示height属性为空。在IE中,所有图像的高度都以1的值显示。

这个PHP变量:

$foto['height']

存储了一个无效的值。

这似乎不是IFRAME的问题,而是与它里面的图像。

您使用height="520px"作为属性,这是不正确的。Size属性必须始终为单个数字,单位为像素。
所以正确的做法是height="520"(宽度也是如此)。或者,使用styles