2012-08-01 87 views
0

我使用this autocomplete函數。我在新項目中運行它,它確實很棒。我把它移到我的主項目,但它沒有工作。 我看着JavaScript控制檯,我也得到jQuery未定義錯誤和無方法

Uncaught ReferenceError: jQuery is not defined jquery.autocomplete.js:2 
(anonymous function) 

Uncaught TypeError: Object [object Object] has no method 'autocomplete' 
(anonymous function) 
jQuery.fn.extend.ready jquery.js:2299 
jQuery.extend.ready.jQuery.readyList jquery.js:2319 
jQuery.extend.each jquery.js:745 
jQuery.extend.ready jquery.js:2318 

我檢查了所有的路徑。

<script src="jscripts/jquery.js" type="text/javascript"></script> 
<link rel="stylesheet" href="skins/skin_1/jquery.autocomplete.css" type="text/css" /> 
<script type="text/javascript" src="jscripts/jquery.autocomplete.js"></script> 

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("#Size").autocomplete("AutocompleteData.ashx"); 
    }); 
    $(document).ready(function() { 
     $("#Color").autocomplete("AutoCompleteData2.ashx"); 
    }); 
    $(document).ready(function() { 
     $("#Brand").autocomplete("AutoCompleteData3.ashx"); 
    });  
    </script> 

<input type="text" ID="Size" runat="server"/> 
<input type="text" ID="Color" runat="server"/> 
<input type="text" ID="Brand" runat="server"/> 

它工作在正常的aspx,html頁面。但我必須把它放在.config頁面中。 它是這樣開始的。我不知道我怎麼解釋它。

<PackageTransform> 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="urn:asp" exclude-result-prefixes="asp"> 

通常我有另一個jQuery,它的工作原理。喜歡這個;

function moveScroller() { 
      var a = function() { 
      var b = $(window).scrollTop(); 
      var d = $("#scroller-anchor").offset().top; 
      var c = $("#scroller"); 
      if (b > d) { 
      c.css({ position: "fixed", top: "0px" }) 
      } else { 
      if (d >= b) { 
      c.css({ position: "relative", top: "" }) 
      } 
      } 
      }; 
      $(window).scroll(a); a() 
      } 

我該如何運行它,或者您是否有任何其他使用數據庫,鍵盤箭頭和鼠標的自動完成系統。謝謝,對不起我的英文。

+0

順便說一句,你不需要3'$(document).ready(...)'函數 - 1將在你那裏的所有3個電話到'autocomplete'中完成。 – Jamiec 2012-08-01 11:39:11

+0

謝謝你,我做到了,仍然沒有工作 – Zii 2012-08-01 11:46:13

+0

不,這不能解決你的問題 - 這是一個觀察(因此我沒有把它作爲答案) – Jamiec 2012-08-01 12:07:12

回答

0

檢查jscripts/jquery.js文件。你說你已經移動了你的項目,所以可能是該文件沒有完全上傳,並檢查jscripts/jquery.autocomplete.js 比較它們的大小和檢查他們完成上傳?