将一页加载到另一页

时间:2016-09-22 14:44:28

标签: jquery html

我使用下面的代码将一个页面加载到另一个页面

<body>
    <ul>
        <li><a id="work" href="">Work</a></li>
        <li><a id="profile" href="">Profile</a></li>
    </ul>
    <div id="container"></div>
<script>
    $("#work").click(function(){
        event.preventDefault();
        $("#container").load("work.html");
    }
    $("#profile").click(function(){
        event.preventDefault();
        $("#container").load("profile.html");
    }
</script>

</body>

在加载的页面中我想加载第3页但是相同的脚本不适用于第3页

work.html

<body>
    <div id="container">
    <button id="btn">Click Me</button>
    </div>
    <script>
        $("#btn").click(function(){
            event.preventDefault();
            $("#container").load("thirdpage.html");
        }
    </scirpt>
</body>

1 个答案:

答案 0 :(得分:0)

如果您已逐字复制代码,则work.html会在您的结束脚本代码中包含拼写错误:iframe.hoverclass { opacity: 1.0; filter: alpha(opacity=100); -moz-transition: all 0.4s ease-out; // etc. } $("iframe").mouseenter(function () { $(this).addClass("hoverclass"); }).click(function () { $(this).removeClass("hoverclass"); }).mouseleave(function () { $(this).addClass("hoverclass"); });

将其更改为</scirpt>,您就可以了。

相关问题