2013-05-07 50 views
0

VS 2010,C#,MVC 3,jQuery 1.8.1.8。項目在另一個開發人員機器上編譯得很好,我試圖設置我的工作。只要.net解決方案運行,jQuery就是未定義的

上運行,我得到一個錯誤信息 「Microsoft JScript運行錯誤:」jQuery的未定義「

它放在一個jQuery UI的Widget功能1.8.18失敗:使用的NuGet

*/(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(b[d]>0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}}))})(jQuery);/*! 

升級什麼都不做,而且基於其他開發人員無法升級,我可以升級到什麼程度是有限的。

我將我的解決方案與其他開發人員進行了比較,他們看起來都一樣。他也沒有使用任何NuGet。

任何人有任何提示?

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=8" /> 
    <title>@ViewBag.Title | Compliance</title> 
    <link rel="shortcut icon" href="favicon.png" /> 

    <script type="text/javascript"> 
     left_width = 163; 
    </script> 

    @Html.CssFile("common.css") 
    @Html.CssFile("MedResearchPrint.css", true, "print") 
    @Html.CssFile("style.css", false) 
    @Html.CssFile("sorting/dataTable.css") 
    @Html.CssFile("menus/single_seventeen.css") 
    @Html.CssFile("galleriffic-5.css") 

    @Html.CssFile("jquery.autocomplete.css") 
    @Html.CssFile("fancybox/jquery.fancybox-1.3.0.css") 
    <link href="@GlobalVariables.ResourceDomain/javascript/msgbox/jquery.msgbox.css"  rel="stylesheet" type="text/css" /> 

    @Html.CssFile("jqueryui/jquery-ui-1.7.2.custom.css") 
    <link href="@GlobalVariables.ResourceDomain/javascript/windows/dhtmlxwindows.css" rel="stylesheet" type="text/css" /> 
    <link href="@GlobalVariables.ResourceDomain/javascript/windows/skins/dhtmlxwindows_dhx_skyblue.css" rel="stylesheet" type="text/css" /> 

    @Html.ScriptFile("jquery-1.5.1.min.js") 
    @Html.ScriptFile("form/jquery.form.js") 
    @Html.ScriptFile("jquery-ui-1.8.18.custom.min.js", false) 
    @Html.ScriptFile("fancybox/jquery.fancybox-1.3.0.pack.js") 
    @Html.ScriptFile("MedResearch.js")  
    @Html.ScriptFile("menu.js")  
    @Html.ScriptFile("effects.core.js")  
    @Html.ScriptFile("jquery.corners.js")  
    @Html.ScriptFile("jquery.cookie.js")  
    @Html.ScriptFile("effects.slide.js")  


    @Html.ScriptFile("sorting/jquery.dataTables.min.js") 
    @Html.ScriptFile("shortcut/shortcut.js") 

    @Html.ScriptFile("jquery.galleriffic.js") 
    @Html.ScriptFile("jquery.opacityrollover.js") 
    <script src="@GlobalVariables.ResourceDomain/javascript/msgbox/jquery.msgbox.min.js" type="text/javascript"></script> 

    @Html.ScriptFile("hash/hash.js") 
    @Html.ScriptFile("time/jquery.ui.timepicker.js", false) 
    @Html.ScriptFile("numeric/jquery.numeric.pack.js", false) 

    <script src="@GlobalVariables.ResourceDomain/javascript/windows/dhtmlxcommon.js" type="text/javascript"></script> 
    <script src="@GlobalVariables.ResourceDomain/javascript/windows/dhtmlxwindows.js" type="text/javascript"></script> 
    <script src="@GlobalVariables.ResourceDomain/javascript/windows/dhtmlxcontainer.js" type="text/javascript"></script> 

    <!--<script type="text/javascript" src="@Url.Content("~/")content/js/jquery-1.7.1.min.js"></script> 
    <script type="text/javascript" src="@Url.Content("~/")content/js/jquery-ui1.8.18.custom.min.js"></script> 
    <script type="text/javascript" src="@GlobalVariables.ResourceDomain/javascript/windows/lib.js"></script>--> 
    <script type="text/javascript">root = "@Url.Content("~/")";</script> 
    <script src="@GlobalVariables.ResourceDomain/javascript/windows/lib.js" type="text/javascript"></script> 
    @Html.ScriptFile("common.js", false) 
    @RenderSection("Head", false) 

    <!--[if lt IE 8]> 
    @Html.CssFile("MedResearchIE.css") 
    @Html.CssFile("IE7Fixes.css", false) 

    <script type="text/javascript"> 
     $(document).ready(function() { 
      if($(".header .filter").val() != null) 
       $(".header").addClass("left"); 
     }); 
    </script> 
    <![endif]--> 


</head> 
<body class="thrColLiqHdr" onload="fixHeight();"> 
    <div id="vp_container"> 
    <a id="top"></a> 
    <div id="container0"> 
     <div id="container"> 
      <div id="masthead" style="background-image: url('@ViewBag.ImageFile');"> 
       <div id="siteName"> 
        <img src="@GlobalVariables.ResourceDomain/images/iresearch.png" alt="iResearch" /> 
       </div> 

       <div id="icons"> 
        <a href="javascript:void(0);" id="toggle_lpanel" class="menu_collapse_left" title="Hide Left Panel">&nbsp;&nbsp;&nbsp;&nbsp;</a>&nbsp;&nbsp; 
        <a href="javascript:void(0);" id="toggle_rpanel" class="menu_collapse_right" title="Hide Right Panel">&nbsp;&nbsp;&nbsp;&nbsp;</a>&nbsp;&nbsp; 
        <a href="javascript:void(0);" id="toggle_bpanels" class="hide_both" title="Hide Both Panels">&nbsp;&nbsp;&nbsp;&nbsp;</a>&nbsp;&nbsp; 
        <a href="javascript:void(0);" onclick="javascript:print();" title="Print"> 
         <img src="@GlobalVariables.ResourceDomain/images/silkIcons/printer.png" alt="print" /> 
        </a>&nbsp;&nbsp; 
       </div> 
       <div id="about_img"> 
        <a href="#" id="image_src" data-number="@ViewBag.ImageNumber" title="Learn more about this image">@ViewBag.ImageDesc</a> 
       </div> 

      <div id="globalNav"> 
       <div id="globalNav_item1" class="globalNav_item"> 
        <a href="http://gradstudies.med.miami.edu" class="glink">Graduate Studies<br /> 
        </a> 
        </div> 
        <div id="globalNav_item2" class="globalNav_item"> 
        <a href="https://research.miami.edu" class="glink">Research Reporting</a> 
        </div> 
        <div id="globalNav_item3" class="globalNav_item_current"> 
         <a href="javascript:void(0);" class="glink">Compliance</a> 
        </div> 
       </div> 
       <div id="utility"> 
        @if(GlobalVariables.User != null) 
        { 
         <text><a href="@Url.Action("logoutcas", "account")" id="sign_out" title="Sign Out">Sign Out</a> |  <span id="active_username">@GlobalVariables.User.ToString()</span> <span id="record_role"></span></text> 

         <input type="hidden" id="user_role" value="@GlobalVariables.User.Role.Code" /> 
        } 
       </div> 
       <div id="globalNav_b"> 
       </div> 
       <!-- end #header --> 
      </div> 

      @if (IsSectionDefined("Left")) 
      { 
       @RenderSection("Left", false) 
      } 
      else 
      { 
       if (ViewBag.MenuGroups != null) 
       { 
        <div id="colleft"> 
         <div id="panel"> 
          @if (GlobalVariables.User != null) 
         { 
           <div id="sidebar1"> 
            <ul id="main-nav"> 
             @foreach (var item in ((List<UMiami.Core.MenuGroup>)ViewBag.MenuGroups).OrderBy(p => p.OrderNumber)) 
             { 
              <li><a class="nav-top-item @(item.IsSelected ? " current" : "")" href="@(item.LinkUrl != null ? item.LinkUrl : "#")">@item.Name</a> 
               @if (item.WebPages.Count > 0) 
               { 
                <ul> 
                 @foreach (var page in item.WebPages.OrderBy(p => p.OrderNumber)) 
                 { 
                  <li><a title="@page.Description" href="@page.LinkUrl" class="@(page.IsSelected ? "current" : "")">@page.Name</a></li> 
                 } 
                </ul> 
               } 
              </li> 
             } 
             @RenderSection("AdditionalMenuItems", false) 

            </ul> 
           </div> 
         } 
         </div> 
        </div> 
       } 
      } 

      <div class="wrapper"> 
      @if (IsSectionDefined("Right")) 
      { 
       <div id="colright"> 
        <div id="panelright"> 
         <div id="sidebar2"> 
          <div class="content"> 
           @RenderSection("Right") 
           <div class="cleaner margin">&nbsp;</div> 
          </div> 
         </div> 
        </div> 
       </div> 
      } 


       <div id="mainContent" class="mainContent"> 
        @RenderBody() 

        <div id="loading" style="display: none;"><img alt="loading..." src="@Url.Content("~/content/img/ajax-loading.gif")" /></div> 
        <form action="/" id="excel_form" method="post"></form> 

        <iframe id="hidden-iframe" style="display:none;"></iframe> 
       </div> 

       <div class="cleaner">&nbsp;</div> 

       <div id="footer"> 
        <p> 
        Sponsored. 
        </p> 
        <div id="anchor"> 
         <a href="#" title="Return to Top"> 
          <img src="@GlobalVariables.ResourceDomain/images/return_btns.gif" alt="top" /></a> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
    </div> 
</body> 
</html> 
+0

這很可能是jQuery沒有正確加載錯誤的環境中。檢查以確保沒有404並且腳本加載順序是正確的(可以從瀏覽器開發人員工具的「網絡」區域檢查這兩項)。另外,確保有人不調用['jQuery.noConflict(true)'](http://api.jquery.com/jQuery.noConflict/).. – user2246674 2013-05-07 18:24:08

+0

它可能是因爲加載順序。它在另一臺計算機上工作的事實可能是因爲瀏覽器差異或機器速度。您可以向我們展示加載腳本的代碼嗎? – Silvermind 2013-05-07 18:26:45

+0

@ user2246674 jQuery.noConflict(true)未被調用;我做了一個搜索。 – sharcfinz 2013-05-07 18:30:35

回答

0

您還沒有在Layout.cshtml文件中註冊jQuery或jQuery UI。您必須先添加對jQuery庫的引用,然後引用jQuery UI庫。 像這裏

<script type="text/javascript" src="/jquery.min.js"></script> 
<script type="text/javascript" src="/jquery.ui.min.js"></script> 
<script type="text/javascript" src="@GlobalVariables.ResourceDomain/javascript/windows/lib.js"></script> 
+0

這是,但現在我得到一個解析器錯誤信息:一個開放的「(」缺少相應的關閉「)」,指向: sharcfinz 2013-05-07 18:44:11

+0

什麼是'root'?嘗試'var root ='@ Url.Content(「〜/」)''而不是 – 2013-05-07 18:51:20

+0

我做到了,現在又回到了原來的錯誤。 ( – sharcfinz 2013-05-07 18:57:00