views:

269

answers:

1

hey,

im new to javascript and am intersted in creating a small o3d script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<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

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

and gives me an uncaught referenceerror at this line

 o3djs.require('o3djs.camera');

Obviously, because it can't find the 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

thanks

+1  A: 

Files that your HTML point to (CSS, JS, links) are searched relative to the document's path.

E.g. 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.

Marcel Korpel
it's too bad google didn't mention that I had to download a zip, or even mentionned where to download it. I had to get it from a sample.thanks
David Menard