2011-11-21 75 views
2

我收到以下錯誤並沒有JavaScript的工作在我的網站: 未捕獲引用錯誤$沒有定義

這是工作,但我現在不能見哪裏有什麼不對任何人都可以幫忙嗎?

我鏈接到這裏的javascript文件:

<script src="js/jquery.js" type="text/javascript"></script> 
<script src="js/jsfunctions.js" type="text/javascript"></script> 

這裏是JS腳本功能

//-------------------------- MENU MOVE 
$(document).ready(function(){ 
    $(".one").hover(function() { 
     $(this).stop().animate({ marginTop: "5px" }, 200); 

    },function(){ 
     $(this).stop().animate({ marginTop: "0px" }, 300); 

    }); 
}); 

$(document).ready(function(){ 
    $(".two").hover(function() { 
     $(this).stop().animate({ marginTop: "5px" }, 200); 

    },function(){ 
     $(this).stop().animate({ marginTop: "0px" }, 300); 

    }); 
}); 


$(document).ready(function(){ 
    $(".three").hover(function() { 
     $(this).stop().animate({ marginTop: "5px" }, 200); 

    },function(){ 
     $(this).stop().animate({ marginTop: "0px" }, 300); 

    }); 
}); 


$(document).ready(function(){ 
    $(".four").hover(function() { 
     $(this).stop().animate({ marginTop: "5px" }, 200); 

    },function(){ 
     $(this).stop().animate({ marginTop: "0px" }, 300); 

    }); 
}); 


$(document).ready(function(){ 
    $(".five").hover(function() { 
    $(this).stop().animate({ marginTop: "5px" }, 200); 

    },function(){ 
     $(this).stop().animate({ marginTop: "0px" }, 300); 

    }); 
}); 


$(document).ready(function(){ 

    $(".plane").stop().animate({ marginRight: "2000px" }, 40000); 


}); 


$(document).ready(function(){ 
    $(".signinbutton").hover(function() { 
     $(this).stop().fadeTo('slow', 0.5); 

    },function(){ 
     $(this).stop().fadeTo('slow', 1.0); 

    }); 
}); 

$(document).ready(function(){ 
    $(".forgotton").hover(function() { 
     $(this).stop().fadeTo('slow', 0.5); 

    },function(){ 
     $(this).stop().fadeTo('slow', 1.0); 

    }); 
}); 


//-------------------------------- SOCIAL FADES 
$(document).ready(function(){ 
    $(".twitter").hover(function() { 
     $(this).stop().fadeTo('slow', 0.7); 

    },function(){ 
     $(this).stop().fadeTo('slow', 1.0); 

    }); 
}); 

$(document).ready(function(){ 
    $(".facebook").hover(function() { 
     $(this).stop().fadeTo('slow', 0.7); 

    },function(){ 
     $(this).stop().fadeTo('slow', 1.0); 

    }); 
}); 

$(document).ready(function(){ 
    $(".rss").hover(function() { 
     $(this).stop().fadeTo('slow', 0.7); 

    },function(){ 
     $(this).stop().fadeTo('slow', 1.0); 

    }); 
}); 

//------------------------------------ EMAIL DETAILS 


$(function() { 

$(".submit").click(function() { 

var name = $("#name").val(); 
var email = $("#email").val(); 
    var comment = $("#comment").val(); 
    var dataString = 'name='+ name + '&email=' + email + '&comment=' + comment; 

    if(name=='' || email=='' || comment=='') 
    { 
    alert('Please Give Valid Details'); 
    } 
    else 
    { 
    $("#flash").show(); 
    $("#flash").fadeIn(400).html('<img src="../img/-loader.gif" align="absmiddle">&nbsp;<span class="loading">Loading Comment...</span>'); 
$({ 
     type: "POST", 
    url: "comment.php", 
    data: dataString, 
    cache: false, 
    success: function(html){ 

    $("ol#update").append(html); 
    $("ol#update li:last").fadeIn("slow"); 
    document.getElementById('email').value=''; 
    document.getElementById('name').value=''; 
    document.getElementById('comment').value=''; 
    $("#name").focus(); 

    $("#flash").hide(); 

    } 
}); 
} 
return false; 
    }); 



}); 

// ----------------------------- Profile Email Check 
$(document).ready(function() { 

     //the min chars for username 
     var min_chars = 3; 

     //result texts 
     var characters_error = 'Minimum amount of chars is 3'; 
     var checking_html = 'Checking...'; 

     //when button is clicked 
     $('#check_username_availability').click(function(){ 
      //run the character number check 
      if($('#username').val().length < min_chars){ 
       //if it's bellow the minimum show characters_error text ' 
       $('#username_availability_result').html(characters_error); 
      }else{ 
       //else show the cheking_text and run the function to check 
       $('#username_availability_result').html(checking_html); 
       check_availability(); 
      } 
     }); 

    }); 

//function to check username availability 
function check_availability(){ 

     //get the username 
     var username = $('#username').val(); 

     //use to run the check 
     $.post("lib/-checkemail.php", { username: username }, 
      function(result){ 
       //if the result is 1 
       if(result == 1){ 
        //show that the username is available 
        $('#username_availability_result').html(username + ' is not registered. They will be sent an email to invite them to sign up.'); 
       }else{ 
        //show that the username is NOT available 
        $('#username_availability_result').html(username + ' is already registered. They will be notified of their invitation via email.'); 
       } 
     }); 

} 

function showImage(){ 
     document.getElementById('overlay').style.visibility='visible'; 
    } 
document.getElementById('.videofullme').style['-webkit-transform'] = 'rotate(90deg)'; 
document.getElementById('.videofullme').style.webkitTransform = 'rotate(90deg)'; 
document.getElementById('.videofullme').style.WebkitTransform = 'rotate(90deg)'; 
+3

示例頁面?另請將您的第一個選擇器更改爲:$(「。one,.two,.three」),然後刪除另外兩個'$(document).read()'函數。 – Chad

回答

6

您對jquery.js引用未加載。

使用Firebug找出原因。

+0

+1擊敗我的答案$是由JQuery定義的簡寫,如果jquery未加載$肯定不會被定義 – Chris

0

可能是你有一些其他的JavaScript庫加載與jquery一樣原型嘗試使用jquery.noconflict並且也使用ready函數一次。

+0

它也可能是一個衝突問題爲什麼我得到一個投票? – Kishore

+1

衝突不會導致'$'未定義;它只會讓'$'做別的事情。 – SLaks

4

查找到螢火蟲或開發者控制檯,以瞭解您的jQuery是加載 - 也許你的應用程序服務器更改URL,或者你是指從子頁面這個JS(請嘗試更改URL到根目錄相對,即開始/)。

另外,在firebug中,你應該能夠發佈一個錯誤發生的線 - 也許還有另一個問題。

而且......

$({      // <-- Shouldn't this be $.ajax ? 
    type: "POST", 
    url: "comment.php", 
    data: dataString, 
    cache: false, 
    success: function(html){ 
     //... 

編輯

是否有posibility,在你jquery.jsjsfunctions.js被稱爲jQuery.noConflict()?不希望:P爲避免這種情況,您可以使用jQuery(function($){ /* ... */ });(function($){ /* ... */ }(jQuery))。當然,假設你有問題只與$,而不是jQuery;]

+2

嘗試將網址更改爲絕對地址 - 以/開始的URL也以'/開始「稱爲相對地址。它們與域有關。除此之外+1 – PeeHaa

+0

是的,我的誤導誤導:/ –

相關問題