2011-11-21 2 views
2
나는 다음과 같은 오류를 얻고있다

정의되지 않고 자바 스크립트 내 사이트에 작동하지 않습니다 : 포착되지 않은 참조 오류 $는

그것은 일하고 정의하지 않고, 문제가있는 곳 난 지금은 볼 수 없습니다 아무도 도와 줄 수 있습니까?

내가 여기에 자바 스크립트 파일에 연결하고 여기

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

을 그리고는 jquery.js에 대한 귀하의 참조가로드되지 않습니다 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

예제 페이지가 있습니까? 또한'$ (".1, .two, .three")'로 첫 번째 선택자를 변경 한 다음 다른 두 개의'$ (document) .read()'함수를 삭제하십시오. – Chad

답변

6

입니다.

방화범을 사용하여 이유를 알아보십시오.

+0

+1 답변 해 주셔서 감사합니다 $는 JQuery에 정의 된 속기입니다. Jquery가 $를 정의하지 않으면 $ – Chris

0

은 프로토 타입처럼 jquery.noconflict를 사용하여 시도하고도 한 번 준비 기능을 사용하여 라이브러리가 jQuery로로드 자바 스크립트 다른이 될 수 있습니다.

+0

도 충돌 문제가 될 수 있습니다. 이유는 무엇입니까? – Kishore

+1

충돌로 인해'$'는 정의되지 않습니다; 그것은 단지'$'다른 것을 할 것입니다. – SLaks

4

firebug 또는 dev 콘솔에서 jQuery로드 여부를 확인하십시오. 앱 서버가 URL을 변경하거나 하위 페이지에서이 JS를 참조하고 있습니다. URL을 루트 상대으로 변경하십시오. /).

또한 방화 광에서 오류가 발생한 행을 게시 할 수 있어야합니다. 다른 문제가있을 수 있습니다. jquery.js 또는 jsfunctions.jsjQuery.noConflict()라고 당신의

그리고 ...

어떤있는 posibility이 있습니까

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

편집, 그? 희망이 아닙니다 : P 이것을 피하려면 jQuery(function($){ /* ... */ }); 또는 (function($){ /* ... */ }(jQuery))을 사용할 수 있습니다. 물론 $과 관련된 문제 만 있다고 가정하면 jQuery;

+2

'URL을 절대로 변경해보십시오. - /'/로 시작하는 URL로 시작하는 URL은 상대적이라고도합니다. 도메인과 관련이 있습니다. 그 외 +1 – PeeHaa

+0

네, 오해의 소지가 있습니다. / –

관련 문제