我有这段代码
function showOpenMaps(position,located){
jQuery.ajaxSetup({
cache:true
});
jQuery.getScript("http://www.openlayers.org/api/OpenLayers.js")
.done(function (script, textStatus) {
$(".geocoder").show();
$("#map_canvas").html("");
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position = new OpenLayers.LonLat(position.coords.longitude, p....
}
我的参数位置未定义,但在getScript
调用之外就可以了。有任何想法吗?它与范围有关吗?