2010-02-04 4 views
4

Scriptaculous를 잘못 설치 한 것으로 보이지만 잘못된 것이 무엇인지 알 수 없습니다. 여기에 문제 보여주는 샘플입니다 ". 효과는 정의되지 않은"나는 "효과 축소"링크를 클릭하면Scriptaculous를 사용할 때 효과가 정의되지 않았습니다.

<html> 
<body> 
<script src="js/prototype.js" type="text/javascript"></script> 
<script src="js/scriptaculous.js" type="text/javascript"></script> 

<p id="hello">Hello, World!</p> 
<a href="javascript:void(0)" onclick="Effect.Shrink('hello');">Shrink effect</a> 
<a href="javascript:void(0)" onclick="$('hello').shrink();">Shrink method</a> 

</body> 
</html> 

, 나는, 자바 스크립트 오류가 "축소 방법"링크를 클릭하면 "$ ("hello ")와 다른 오류가 발생합니다. shrink는 함수가 아닙니다."

문제는 내가 명시 적으로 효과 스크립트에 연결하면 도망 간다 :

<html> 
<body> 
<script src="js/prototype.js" type="text/javascript"></script> 
<script src="js/scriptaculous.js" type="text/javascript"></script> 
<script src="js/effects.js" type="text/javascript"></script> <!-- Added --> 

<p id="hello">Hello, World!</p> 
<a href="javascript:void(0)" onclick="Effect.Shrink('hello');">Shrink effect</a> 
<a href="javascript:void(0)" onclick="$('hello').shrink();">Shrink method</a> 

</body> 
</html> 

이 해결 방법은 허용되지만 수 없습니다 script.aculo.us의 부하 모든 도우미 스크립트를 자동으로? 그것이해야한다고 말하는 installation instructions 것 같습니다.

내 html 파일과 js 폴더는 웹 서버의 루트 폴더에 없으며 둘 다 응용 프로그램 폴더 아래에 있습니다. Firefox 3.5.7 및 Internet Explorer 8.0에서도 동일한 동작이 나타납니다.

답변

3

는이 같은 HTML 문서의 <head><script> 정의를 넣어해야합니다

<html> 

<head> 
<script src="js/prototype.js" type="text/javascript"></script> 
<script src="js/scriptaculous.js" type="text/javascript"></script> 
</head> 

<body> 

<p id="hello">Hello, World!</p> 
<a href="javascript:void(0)" onclick="Effect.Shrink('hello');">Shrink effect</a> 
<a href="javascript:void(0)" onclick="$('hello').shrink();">Shrink method</a> 

</body> 
</html> 

트릭을해야한다고.

+1

지침을 다시 읽었으므로 "이 작업은 문서의 머리글 *에있는 스크립트에 연결하여 수행됩니다." –

관련 문제