我遇到了一个奇怪的错误。我正在尝试加载 Google 地球库,但这样做时出现错误“ERR_CREATE_PLUGIN”
以下代码确实有效:
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("earth", "1");
var ge = null;
function init() {
google.earth.createInstance("map3d", initCallback, failureCallback);
}
function initCallback(object) {
ge = object;
ge.getWindow().setVisibility(true);
}
function failureCallback(object) {
}
</script>
</head>
<body onload='init()' id='body'>
<center>
<div id='map3d'
style='border: 1px solid silver; height: 600px; width: 800px;'></div>
</center>
</body>
虽然此代码没有:
<script type="text/javascript">
google.load("earth", "1");
var ge = null;
function initCallback(object) {
ge = object;
ge.getWindow().setVisibility(true);
}
function failureCallback(object) {
}
$(document).ready(function() {
google.earth.createInstance("map3d", initCallback, failureCallback);
});
</script>