这可能是显而易见的......但我看不到它.除了marker.setPosition操作之外,以下代码按预期工作:
<head>
<title>Test Simulation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=x&sensor=false">
</script>
<script type="text/javascript">
var marker = null;
var myLatlng = null;
var map = null;
var image = null;
var mapOptions = null
function movemarker()
{
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://x.com/x13/?testloc=1",false);
xmlhttp.send();
var data = xmlhttp.responseText;
vals = data.split(',');
latv = parseFloat(vals[0]);
lonv = parseFloat(vals[1]);
myLatlng = new …
Run Code Online (Sandbox Code Playgroud)