我有一个图像,我正试图将它旋转30度,并在页面上水平移动。但是,我认为我没有正确处理jquery,因为我在Firefox Web控制台中收到了几个错误。以下是错误:
[10:30:27.260] ReferenceError: jQuery is not defined @ file:///home/ladmin/Desktop/javascriptAnimations/jquery.rotate.1-1.js:1
[10:30:27.274] The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol. @ file:///home/ladmin/Desktop/javascriptAnimations/si110cockroach.html
[10:31:03.416] ReferenceError: $ is not defined @ file:///home/ladmin/Desktop/javascriptAnimations/si110cockroach.html:12我在顶部的jquery源代码中包含了脚本标记,如下所示:
<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>下面是我调用jquery的代码:
function moveLeft(object,x,y){
$(object).rotateRight(30);
object.style.right = x + "px";
object.style.top = y + "px";
if (x < 0 || x > 1500 || y < 0 || y > 1500)
{
object.style.visibility="hidden";
}
else
{
var t = setTimeout(function() { moveLeft(object,x+3,y+0); }, 5);
}
}我是不是没有正确地包含源文件,或者我没有正确地调用jquery?
发布于 2012-07-19 22:41:57
您必须在jquery.rotate.1-1.js脚本之前包含jquery.min.js:
<script language="javascript" type="text/javascript" src="jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>https://stackoverflow.com/questions/11563238
复制相似问题