var spotlat = document.getElementById("lat0").innerHTML;
var spotlng = document.getElementById("lng0").innerHTML;

     erspot = new google.maps.Marker({
        position: new google.maps.LatLng(spotlat,spotlng), 
        map: map,
        icon: image           
       });
position无法得到坐标
但是换成具体数据就可以了
请问有没有大牛能够指导下?

解决方案 »

  1.   

    alert(spotlat );  显示值是多少
      

  2.   

    var spotlat = parseFloat(document.getElementById("lat0").innerHTML);
    var spotlng = parseFloat(document.getElementById("lng0").innerHTML);erspot = new google.maps.Marker({
        position: new google.maps.LatLng(spotlat,spotlng), 
        map: map,
        icon: image  
    });
      

  3.   

    new google.maps.LatLng这个方法的两个参数不是innerHTML这种字符串 而是数值
      

  4.   

    结果不对
    用alert看position 至少显示的正确
      

  5.   

    那怎么处理 加numeric?
      

  6.   

    解决问题了实际上是因为地图初始化的问题所以google map初始化很重要