2012-05-16 51 views
0

我的jQuery代碼不工作,並在螢火蟲控制檯它說:「jQuery沒有定義」。我檢查jQuery正在加載,但我仍然沒有得到它爲什麼顯示錯誤。jQuery沒有定義,找不到原因?

網站URL在下面的評論中給出,所以我可以在問題解決時將其刪除。您的幫助將不勝感激。

我的jQuery代碼看起來像:

(function($) { 
$(document).ready(function() { 
$("form#add #divOptionsBlock .item img").css("visibility","hidden"); 

$('#divOptionsBlock .txtBoxStyle:first').change(function() { 

    var fpath = $("#divOptionsBlock .item img").attr("src") ; 

    var finalimage = 'http://shop.daactive.com/thumbnail.asp?file='+fpath+'&maxx=300&maxy=0'; 

    var fpath2 = $("form#add img#large").attr("src",finalimage); 

    var imagepath_ahref="http://shop.daactive.com/"+fpath; 
    var fpath3 = $("form#add a#listing_main_image_link").attr("href",imagepath_ahref); 

    var fpath4 = $("form#add a#listing_main_image_link .MagicBoxShadow img").attr("src",imagepath_ahref); 


    var textvalue = $('#divOptionsBlock .txtBoxStyle:first option:selected').text() 
    $("#imagecaptiont").html(textvalue); 


}); 
});  
}) (jQuery); 
+0

可能是這個提問者看到的奇怪的東西,特別是如果它只在Firefox 4中。http://stackoverflow.com/questions/10605780/jquery-undefined-and-undefined-errors-in-firefox-4/10605914# 10605914 –

+0

你有鏈接到jQuery文件嗎? – Blazemonger

+0

是的,我有和它的加載我檢查了它在螢火蟲NET – Imran

回答

3

您不包括jQuery的!添加到您的<head><body>年底前:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
0

看起來你是從http://shop.daactive.com/prototype.js而不是jQuery的加載的prototype.js(V 1.6.0.3)。

要繼續使用的原型,你將需要重構自己的JavaScript原型庫,而不是jQuery的一個:http://api.prototypejs.org/

如果您選擇包括jQuery的太多,你需要在它的「安全」使用jQuery模式: http://docs.jquery.com/Using_jQuery_with_Other_Libraries

但是這將意味着加載2個JavaScript庫,並且可以是一大堆的JavaScript加載,並承擔頁面加載時間。