2010-03-31 86 views
0

即时通讯新的JavaScript和上午位数的创建一个小的O3D脚本:O3D的JavaScript未捕获引用错误

<!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> 

并给我一个未捕获的ReferenceError在该行

o3djs.require('o3djs.camera'); 

很明显,因为它无法找到o3djs /基地。 JS ...

我已经安装了O3D从谷歌撑着,他们说这应该是它 在Firefox,IE和Chrome的

感谢

我用尽
+0

你在哪里放的JavaScript源(“base.js”)?你的页面来自哪里? – Pointy 2010-03-31 13:26:36

+0

即时通讯只是试图现在在本地运行页面。就是这样,所有o3d的网站告诉我要做的就是安装插件,我很好。 – 2010-03-31 13:55:57

回答

1

的文件,你的HTML点(CSS, JS,链接)相对于文档的路径进行搜索。

E.g.如果您的文档的URL是http://localhost/foo/testpage.html,则在这种情况下,您必须在http://localhost/foo/o3djs/等中提及base.js。因此,如果您的本地主机位于C:\ Server(假设您使用某种类似Windows的环境),则必须将该文件命名为C:\服务器\ FOO \ o3djs \ base.js。

+0

这太糟糕谷歌没有提到,我不得不下载一个zip,甚至提到下载它在哪里。我必须从样本中得到它。 谢谢 – 2010-03-31 14:28:49