缺失:在地理位置中属性id javascript错误之后

时间:2010-05-07 23:14:18

标签: javascript maps

任何人都可以看到以下问题我希望它是一个简单的障碍,但它让我疯了......

firebug提出'失踪:财产后身份' - 我已经在网上看了但是不能理解它

任何想法..?

  navigator.geolocation.getCurrentPosition(function(position){
  var lat = position.coords.latitude;
  var lon = position.coords.longitude;
  var request = {
  request.origin = position.coords.latitude + ',' + position.coords.longitude;,

  travelMode: google.maps.DirectionsTravelMode.DRIVING
  };

});
},function(error){
//use error.code to determine what went wrong
});

1 个答案:

答案 0 :(得分:2)

var request = {
  request.origin = position.coords.latitude + ',' + position.coords.longitude;,

  travelMode: google.maps.DirectionsTravelMode.DRIVING
  };

应该

// notice the "origin:" 
var request = {
  origin: position.coords.latitude + ',' + position.coords.longitude,

  travelMode: google.maps.DirectionsTravelMode.DRIVING
  };