2 回答
TA贡献1873条经验 获得超9个赞
快速修复:将document.writeclient1.js 中的调用替换为console.log
document.addEventListener("DOMContentLoaded", function() {
var mouse = {
click: false,
move: false,
pos: {x:0, y:0},
pos_prev: false
};
// get canvas element and create context
var mouse = {
click: false,
move: false,
pos: {x:0, y:0},
pos_prev: false
};
// get canvas element and create context
console.log("Hetoo ");
var canvas = document.getElementById("canvas");
if(canvas)
{
console.log("got her.");
}
else
{
console.log(canvas);
}
console.log(" Hepoo ");
var context = canvas.getContext('2d');
console.log("Heyoo ");
})
您还应该考虑将脚本标记移动到head元素中,并在必要时使用async或defer属性来控制它们的加载方式
添加回答
举报