为什么我的Javascript文件根本不起作用?

时间:2014-12-03 04:38:06

标签: javascript asp.net

我的网站运行正常,所有的javascript文件也可以在我的计算机上运行,​​但在发布到服务器之后,所有文件都可以正常工作,除了 super.js文件。菜单中的链接应该可以工作,但它只显示& #34;#"

<script type="text/javascript" src="/App_Themes/standart2/js/jquery.min.js"></script>
<script type="text/javascript" src="/App_Themes/standart2/js/bootstrap.min.js"></script>
**<script type="text/javascript" src="/App_Themes/standart2/js/super.js"></script>**
<script type="text/javascript" src="/newfiles/calendar/js/jquery-ui.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.easing-1.3.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.easing.compatibility.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.jcarousellite.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.jcarousellite.min.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.mousewheel-3.1.12.js"></script>

以下是我的文件[链接](http://jsfiddle.net/programmer777/oxj69tum/embedded/result/)的代码段代码!我不了解问题,到处寻找,但无法找到解决方案。

$(document).ready(function () {

    var menuLinksNew = $(".menuH>li>a");

    var pathname = $(location).attr('pathname');

    if (pathname.substring(1, 3) == "eng") {

        $(menuLinksNew[0]).attr("href", "/about");
        $(menuLinksNew[0]).text("About");

    }
    else if (pathname.substring(1, 3) == "fr") {

        $(menuLinksNew[0]).attr("href", "/about");
        $(menuLinksNew[0]).text('About');

    }

    var submenuNew1 = $(".menuH ul a");
    if (pathname.substring(1, 3) == "eng") {


        $(submenuNew1[0]).attr("href", "/eng/about/info");
        $(submenuNew1[0]).children("h5").text("blah");
        $(submenuNew1[1]).attr("href", "/eng/about/info/1");
        $(submenuNew1[1]).children("h5").text("blah");
        $(submenuNew1[2]).attr("href", "/eng/about/info");
        $(submenuNew1[2]).children("small").text('blah');
        $(submenuNew1[3]).attr("href", "/eng/about/info");
        $(submenuNew1[3]).children("small").text('blah');
     }
else if (pathname.substring(1, 3) == "fr") {

        $(submenuNew1[0]).attr("href", "/fr/about/info");
        $(submenuNew1[0]).children("h5").text("blah");
        $(submenuNew1[1]).attr("href", "/fr/about/info/1");
        $(submenuNew1[1]).children("h5").text("blah");
        $(submenuNew1[2]).attr("href", "/fr/about/info");
        $(submenuNew1[2]).children("small").text('blah');
        $(submenuNew1[3]).attr("href", "/fr/about/info");
        $(submenuNew1[3]).children("small").text('blah');

});

1 个答案:

答案 0 :(得分:1)

 if (pathname.substring(1, 3) == "eng") {


    $(submenuNew1[0]).attr("href", "/eng/about/info");
    $(submenuNew1[0]).children("h5").text("blah");
    $(submenuNew1[1]).attr("href", "/eng/about/info/1");
    $(submenuNew1[1]).children("h5").text("blah");
    $(submenuNew1[2]).attr("href", "/eng/about/info");
    $(submenuNew1[2]).children("small").text('blah');
    $(submenuNew1[3]).attr("href", "/eng/about/info");
    $(submenuNew1[3]).children("small").text('blah');
**}**

else if(pathname.substring(1,3)==“fr”){

如果缺少,那么支持之前的支撑。