我从Filezilla登录到我的FTP并试图打开一个JS文件,它给了我以下错误:
Script: C:/.../slider.js
Line: 1
Char: 1
Error: 'document' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
Run Code Online (Sandbox Code Playgroud)
我有jQuery链接到.php文件...'document'来自:
$(document).ready(function() {
//Code is here...
});
Run Code Online (Sandbox Code Playgroud)
我尝试下载文件并打开它,我尝试删除$(文档).ready();,我尝试删除jquery(顺便说一下,当我打开jQuery文件时它给了我同样几乎相同的错误).任何帮助表示赞赏.谢谢!
编辑:
这篇文章的标签之一是"asp.net",但老实说我甚至不知道它是否与asp.net有关...
我想这样做:
$("#canvasDiv").mouseover(function() {
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
$(".filler").text("( e.pageX, e.pageY ) : " + pageCoords);
$(".filler").text("( e.clientX, e.clientY ) : " + clientCoords);
});
Run Code Online (Sandbox Code Playgroud)
在控制台中我得到了这个:
Uncaught ReferenceError: e is not defined
我不明白......我认为e应该是JavaScript已经设置的变量...帮助?
我正在制作一个有趣的蛇游戏,练习JavaScript /画布,到目前为止我所说的是一个while循环说,while i is < 100, then add a square并且通过使用fillRect(10, 10, xCoord, yCoord)和在while循环中添加xCoord = xCoord + 11;了正方形,所以它将方块向右移动介于两者之间的空间......这是一个链接:
http://brycemckenney.com/snake_canvas
以及相关代码:
while(i < 100) {
// fillRect(x, y, width, height)... x is horizontal and y is vertical...
context.fillRect(xCoord, yCoord, sW, sH);
// We want each squere to have one pixel in between them, so we increment by 11, not 10.
xCoord = xCoord + 11;
// When i (0) gets to numOfSquares (3), then make the …Run Code Online (Sandbox Code Playgroud) 我知道我将文件链接正确,因为它显示在Chrome上的检查器中.这是我的HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQuery</title>
<script type='text/javascript' src='jquery-1.7.2.min.js'></script>
<script type='text/javascript' src='scripts/change.js'></script>
</head>
<body>
<p>
<button id="start">Start</button>
<button id="stop">Stop</button>
</p>
<p id="image">
<img src='images/image.jpg' alt="image" />
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$('#start').click(function() {
$('#image').slideToggle(3000);
});
Run Code Online (Sandbox Code Playgroud) 我正在使用带有PhoneGap的HTML,CSS和JavaScript为iPhone和Android制作应用程序.我正在使用HTML5画布.我的ctx.drawImage(); 功能不起作用,我无法弄清楚原因.这是我的代码.
var imageReady = false;
var image = new Image();
image.onload = function () {
imageReady = true;
};
image.src = "http://urlToImage.com";
ctx.drawImage(image, 0, 0, 300, 180);
Run Code Online (Sandbox Code Playgroud)
我验证了src链接并且它有效.有什么想法吗?谢谢.