2010-03-31 81 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