如果 javascript 被调用或执行,依赖于什么?准确地说,我有两个以相同方式调用的函数:
[self.mapView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:@"setMarkerAtPosition(%f,%f)",
latlong.latitude, latlong.longitude]];
和
[self.mapView stringByEvaluatingJavaScriptFromString:@"test()"];
但calculateRoute()
被执行而不被执行test()
。怎么来的?
function setMarkerAtPosition(lat, long){
var position = new google.maps.LatLng(lat, long);
var marker = new google.maps.Marker({position: position,
map: map,
title:"Hello World!",
animation: google.maps.Animation.DROP});
var content = "Ich bin eine normale Infobox";
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(content);
infowindow.open(map,marker);
reportClickedMarker();
});
}
function test(){
alert(currentPosition.latitude + ', ' + currentPosition.longitude);
}
谢谢