我是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>浏览器似乎找不到此行中的o3djs/base.js
<script type="text/javascript" src="o3djs/base.js"></script>并在这一行给了我一个未捕获的引用错误
o3djs.require('o3djs.camera');显然,因为它找不到o3djs/base.js...
我已经安装了来自谷歌的o3d插件,他们说我应该在火狐,即和chrome上试用
谢谢
发布于 2010-03-31 22:12:30
HTML指向的文件(CSS、JS、链接)是相对于文档路径进行搜索的。
例如,如果您的文档的URL是http://localhost/foo/testpage.html,在这种情况下,您必须将提到的服务器放在http://localhost/foo/o3djs/中,依此类推。因此,如果您的本地主机位于C:\ base.js (假设您使用类似Windows的环境),则该文件必须称为C:\Server\foo\o3djs\base.js。
发布于 2011-06-28 21:10:14
此外,还要确保包含该应用程序接口所需的所有其他文件,其中大多数文件可以在以下位置找到:http://o3d.googlecode.com/svn/trunk/samples_webgl/o3djs/
https://stackoverflow.com/questions/2553235
复制相似问题