部分视图链接在Firefox中不起作用

时间:2012-09-15 09:21:05

标签: jquery asp.net-mvc asp.net-mvc-4 html.actionlink

我有一个MVC4 asp.net应用程序,我有两个布局主页面的主要布局和嵌套页面的第二个布局。我遇到的问题是第二个布局,在这个布局上我称之为具有导航链接的局部视图。在IE中,导航菜单显示正常,当单击每个项目时,它会按预期导航。但是在FF中,当页面呈现时会显示导航栏,但如果您将其视为简单文本,则它没有“点击功能”。

我的嵌套页面布局:

<header>
            <img src="../../Images/fronttop.png" id="nestedPageheader" alt="Background Img"/>
            <div class="content-wrapper">

                <section >
                    <nav>
                    <div id="navcontainer">
                    </div>
                    </nav>
                 </section>
            <div>
         </header>

用于检索布局页面上动态链接的部分视图和信息的脚本。

<script type="text/javascript">
var menuLoaded = false;
$(document).ready(function () {
    if($('#navcontainer')[0].innerHTML.trim() == "")
    {
        $.ajax({
                url: "@Url.Content("~/Home/MenuLayout")",
                type: "GET",
                success: function (response, status, xhr)
                            {
                                var nvContainer = $('#navcontainer');
                                nvContainer.html(response);
                                menuLoaded = true;
                            },
                error: function (XMLHttpRequest, textStatus, errorThrown)
                        {
                                var nvContainer = $('#navcontainer');
                            nvContainer.html(errorThrown);
                        }
                });
   }
});
</script>

部分观点:

 @model Mscl.OpCost.Web.Models.stuffmodel

<div class="menu">
    <ul>
        <li><a>@Html.ActionLink("Home", "Index", "Home")</a></li>
        <li><a>@Html.ActionLink("some stuff", "stuffs", "stuff")</a></li>
        <li> <h5><a><span>somestuff</span></a></h5>

                    <ul>
                        <li><a>stuffs1s</a>
                        <ul>
                            @foreach (var image in Model.stuffs.Where(g => g.Grouping == 1))
                            {
                                <li>

                                <a>@Html.ActionLink(image.Title, "stuffs", "stuff", new { Id = image.CategoryId }, null)</a>
                                </li>
                            }

                        </ul>
                        </li>
                   </ul>
        </il>
        </ul>
        </div>

我需要知道为什么这在IE中工作正常,但为什么它不能在FF(所有版本)中工作。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

替换此行

<a>@Html.ActionLink(image.Title, "stuffs", "stuff", new { Id = image.CategoryId }, null)</a>

@Html.ActionLink(image.Title, "stuffs", "stuff", new { Id = image.CategoryId }, null)

由于@Html.ActionLink将生成锚本身。

相关问题