简体   繁体   English

O3D JavaScript未捕获的参考错误

[英]o3d javascript uncaught reference error

im new to javascript and am intersted in creating a small o3d script: 我是javascript的新手,并且对创建一个小的o3d脚本感兴趣:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Game Website</title>
</head>

<body>

<script type="text/javascript" src="o3djs/base.js"></script>
<script type = "text/javascript" id="myscript">

o3djs.require('o3djs.camera');

window.onload = init;

function init(){
 document.write("jkjewfjnwle");
}

</script>

<div align="background">
 <div id="game_container" style="margin: 0px auto; clear: both; background-image: url('./tmp.png'); width: 800px; height:600px; padding: 0px; background-repeat: no-repeat; padding-top: 1px;"></div>
</div>

</body>
</html>

the browser cant seem to find o3djs/base.js in this line 浏览器似乎无法在此行中找到o3djs / base.js

<script type="text/javascript" src="o3djs/base.js"></script>

and gives me an uncaught referenceerror at this line 并在这一行给了我一个未捕获的referenceerror

 o3djs.require('o3djs.camera');

Obviously, because it can't find the o3djs/base.js... 显然,因为找不到o3djs / base.js ...

I have installed the o3d pluggin from google and they say that should be IT ive tried on firefox, ie and chrome 我已经从Google安装了O3D Pluggin,他们说应该在Firefox上尝试它,即和chrome

thanks 谢谢

Files that your HTML point to (CSS, JS, links) are searched relative to the document's path. HTML指向的文件(CSS,JS,链接)是相对于文档路径进行搜索的。

Eg if your document's URL is http://localhost/foo/testpage.html , in this case you must put mentioned base.js in http://localhost/foo/o3djs/ , etc. So, if your localhost is at C:\\Server (assuming you use some Windows-like environment), the file must be called C:\\Server\\foo\\o3djs\\base.js. 例如,如果文档的URL是http://localhost/foo/testpage.html ,在这种情况下,您必须将提到的base.js放在http://localhost/foo/o3djs/等中。因此,如果您的本地主机位于C :\\ Server(假设您使用某些类似于Windows的环境),则该文件必须名为C:\\ Server \\ foo \\ o3djs \\ base.js。

还要确保您包含API所需的所有其他文件,其中大多数文件都可以在以下位置找到: http : //o3d.googlecode.com/svn/trunk/samples_webgl/o3djs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM