function   locate2(toolbar,x,y,model){ 
        x=x*1e16; 
        y=y*1e16; 
   //var newDeltaX = new Marker().this.infoDiv.style.left;
  //alert(newDeltaX)    
        var   mapDiv   =toolbar.mapDiv; 
        var   newCenterCoord   =   new   Coordinate(x,   y); 
        toolbar.model.setViewCenterCoord(newCenterCoord); 
        var   control   =   new   Abstract.Control(); 
        control.loadTiles(toolbar.model,   mapDiv.parentNode,   mapDiv,   true); 
        toolbar.model.controls[toolbar.model.ovId].paint(toolbar.model); 
        toolbar.model.controls[mapDiv.id].paint(toolbar.model,   true);                                   
        } 

解决方案 »

  1.   


    //这样:
    function       locate2(toolbar,x,y,model){   
                    x=x*1e16;   
                    y=y*1e16;   
            //var   newDeltaX   =   new   Marker().infoDiv.style.left; 
            //alert(newDeltaX)         
                    var       mapDiv       =toolbar.mapDiv;   
                    var       newCenterCoord       =       new       Coordinate(x,       y);   
                    toolbar.model.setViewCenterCoord(newCenterCoord);   
                    var       control       =       new       Abstract.Control();   
                    control.loadTiles(toolbar.model,       mapDiv.parentNode,       mapDiv,       true);   
                    toolbar.model.controls[toolbar.model.ovId].paint(toolbar.model);   
                    toolbar.model.controls[mapDiv.id].paint(toolbar.model,       true);                                                                       
                    }   
      

  2.   

    Maker m=new Maker();//建立对象
    m.showInfoWindow();//调用对象的方法
      

  3.   

    new   Marker().infoDiv.style.left;出错了 说这里为空或不是对象
      

  4.   

    先调下 showInfoWindow(); 再去取值
      

  5.   

    你这个应该用了什么框架了吧??
    Class,Util这种对象没见过啊..
      

  6.   

    在每个JS文件里都把它作为一个类对象创建的 Util是个Util.js文件 上面提到的Util.什么的在它的JS里都有定义这些方法
      

  7.   

    //楼主用了 prototype ?
    //这样:
    function       locate2(toolbar,x,y,model){   
                    x=x*1e16;   
                    y=y*1e16;   
            //var   mk =   new   Marker();
            //mk.showInfoWindow();
            //var  newDeltaX = mk.infoDiv.style.left; 
            //alert(newDeltaX)         
                    var       mapDiv       =toolbar.mapDiv;   
                    var       newCenterCoord       =       new       Coordinate(x,       y);   
                    toolbar.model.setViewCenterCoord(newCenterCoord);   
                    var       control       =       new       Abstract.Control();   
                    control.loadTiles(toolbar.model,       mapDiv.parentNode,       mapDiv,       true);   
                    toolbar.model.controls[toolbar.model.ovId].paint(toolbar.model);   
                    toolbar.model.controls[mapDiv.id].paint(toolbar.model,       true);                                                                       
                    }
      

  8.   

     还是不对 提示说 this.sPoint.x 为空或不是对象
      

  9.   

    mk.showInfoWindow();执行到这里出错的
      

  10.   

    \
    ]那说明你的 Marker 类写的就不对嘛
      

  11.   

    说showInfoWindow:   function()函数里的
    var newDeltaX = this.sPoint.x + this.icon.width-8; 这句的this.sPoint.x为空或不是对象但当我不调用locate2()这个函数的时候 this.sPoint.x是可以打印出来值的 在调用了这个函数的时候(如果不加       //var   mk =   new   Marker();
            //mk.showInfoWindow();
            //var  newDeltaX = mk.infoDiv.style.left; 
            //alert(newDeltaX)这些也是可以的 就是加了执行到mk.showInfoWindow();时出this.sPoint.x为空或不是对象的错 晕了哦 )
      

  12.   

    那么你在 showInfoWindow 的方法里面去弹出 this.infoDiv.style.left 看对吗?
      

  13.   

    setToMap: function(mapDiv, model, overLayDiv)怎样调用啊?