0x800a1391将init()视为错误 [英] 0x800a1391 getting init() as error

查看:67
本文介绍了0x800a1391将init()视为错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Unhandled exception at line 19, column 15 in ms-appx://6d58f381-98f8-4be7-b73a-47cb89dfe1b6/default.html

0x800a1391 - JavaScript runtime error: 'init' is undefined

If there is a handler for this exception, the program may be safely continued.

推荐答案

这可能会导致因为你在加载DOM元素之前尝试获取canvas对象。

解决方案是调用body中的body和init canvas的方法。



This may cause because you are trying to get canvas object before loading the DOM elements.
Solution is call a method onload of body and init canvas inside that funtcion.

<body onload="init()">




function init() {
   canvas = document.getElementById("gameCanvas");;
   context = canvas.getContext('2d');
}





希望这会对你有所帮助

快乐编码:)



Hope this helps you
Happy Coding :)


这篇关于0x800a1391将init()视为错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆