0
votes

I copy the codes from Google Earth API Developer's Guide,deployed in eclipse's Dynamic Web Project,just like below.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sample</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var ge;
google.load("earth","1");
function init(){
    google.earth.createInstance('map3d',initCB,failureCB);
}
function initCB(instance){
    ge=instance;
    ge.getWindow().setVisibility(true);
    ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
}
function failureCB(errorCode){
    alert("failure");
}
google.setOnloadCallback(init);
</script>

</head>
<body>
<div id="map3d" style="height:400px;width:600px;border:1px solid red"></div>
</body>

The website shows red frame but the earth does't exist,what wrong with with my code,thanks!!

1
the code looks good to me however you mention 'eclipse's Dynamic Web Project' - I am not sure what that is exactly but it is probably interfering - lifeIsGood
Are you sure you have the Google Earth plugin installed? By default it should prompt you to install if you have not. - Fraser

1 Answers

0
votes

You have a spelling error in

google.setOnloadCallback(init);

Should be:

google.setOnLoadCallback(init);