如何在内容头内容之前加载主头内容

时间:2013-01-19 19:06:05

标签: jquery asp.net html head master

我有类似的东西..

在母版页上

<head runat="server">
    <link href="../StyleSheets/Main_Master.css" rel="stylesheet" type="text/css" />
    <%--<script type="text/javascript" src="../../Scripts/jquery-1.8.3.js"></script>--%>
    <script src="../../Scripts/Mainmenu.js" type="text/javascript"></script>
    <link href="../../Misc/Plugins/OrbitSlider/orbit-1.2.3.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Misc/Plugins/OrbitSlider/jquery.orbit-1.2.3.min.js"></script>
</head>

内容页面

<asp:Content ContentPlaceHolderID="LeftBarHeadContent" runat="server">
    <script src="../../Scripts/jquery-1.8.3.js"></script>
    <link href="../StyleSheets/Home_Content.css" rel="stylesheet" type="text/css" />
    <link href="../StyleSheets/Content_Common.css" rel="stylesheet" />
    <script src="../../Scripts/Contents_Common.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.cycle.all.js" type="text/javascript"></script>
</asp:Content>

现在,这会在浏览器上呈现

<head>
<script src="../../Scripts/jquery-1.8.3.js"></script>
        <link href="../StyleSheets/Home_Content.css" rel="stylesheet" type="text/css" />
        <link href="../StyleSheets/Content_Common.css" rel="stylesheet" />
        <script src="../../Scripts/Contents_Common.js" type="text/javascript"></script>
        <script src="../../Scripts/jquery.cycle.all.js" type="text/javascript"></script>
        <link href="../StyleSheets/Main_Master.css" rel="stylesheet" type="text/css" />
        <%--<script type="text/javascript" src="../../Scripts/jquery-1.8.3.js"></script>--%>
        <script src="../../Scripts/Mainmenu.js" type="text/javascript"></script>
        <link href="../../Misc/Plugins/OrbitSlider/orbit-1.2.3.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="../../Misc/Plugins/OrbitSlider/jquery.orbit-1.2.3.min.js"></script>
    </head>

现在,您可以看到内容元素在主内容之前呈现。我之前需要加载主内容,因为如果插件出现之前没有包含jquery,我的某些插件会抛出未解决的jquery错误。

1 个答案:

答案 0 :(得分:3)

主页中的LeftBarHeadContent在哪里?

您需要在主页的<asp:contentplaceholder id="LeftBarHeadContent" runat="server" />中放置<head>之类的内容...