0

やあ

divタグでホームページを表示したい。これは、ブラウザー Firefox、Chrome、Opera では機能する小さなコードですが、Internet Explorer では機能しません。ヒントはありますか?

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="http://localhost/myproj/jquery-1.9.0.min.js"></script>
        <style>
            body {
                background-color: lightsalmon;
            }
            .inner_homepage_div {
                position: fixed;
                top : 100px;
                left : 0px;
                width: 100%;
                z-index:10;
            }
        </style>
        <title></title>
    </head>
    <body>
    <script type="text/javascript">
        (function($) {
            $(document).ready(function() {
                function fHeight() {
                    $('#inner_page').height($(window).height()-125);
                    $('#hpage').css({
                        'width': '100%',
                        'height': '100%'
                    });
                }
                $('#inner_page').html('<object id="hpage" data="http://www.ee" />');
                fHeight();
                fHeight();
                $(window).resize(fHeight);
            });//
        })(jQuery);
    </script>
    <div id="inner_page" class="inner_homepage_div"></div>
    </body>
</html>

ありがとうございました

4

2 に答える 2

0

IE との最適な互換性を実現するには、http://modernizr.com/または / のスクリプトを使用できます。また、HTML5 要素には HTML5-trunkを使用できます。

<!--[if IE]>
     <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

しかし、あなたのコードを見ると、幅100%と高さ100%が同時に発生するために問題が発生する可能性があります.古いブラウザはこれをサポートしていません. さらに、jQuery-Plugin のように jQuery スニペットを挿入するのはなぜですか? 単純に使用します:

     $(function() {
        function fHeight() {
            $('#inner_page').height($(window).height()-125);
            $('#hpage').css({
                'width': '100%',
                'height': '100%'
            });
        }
        $('#inner_page').html('<object id="hpage" data="http://www.ee" />');
        fHeight();
        // fHeight(); -> why the second time???
        $(window).resize(fHeight);
    });
于 2013-02-11T15:10:30.797 に答える
0

http://www.eeとは何ですか?行方不明です.. ビット 実際に何かを得ていますか? もしそうなら何?(コメントとして投稿しますが、スタックはあなたに50担当者を持たせたいと思っています)

于 2013-02-11T13:19:23.233 に答える