object error

Discussion in 'JavaScript' started by Sleeping Troll, May 14, 2009.

  1. #1
    This is the code, I think it's function is obvious... can anyone tell what the problem is?

     
    
    function moveball(x,y,z){
    
      try{
    
      var k=(Zeye-Zscreen)/(Zeye-z);
    
      var bs=Math.round(ballsize*k);
    
      this.is.width=2*bs;
    
      this.is.height=2*bs;
    
      this.is.left=(x+xmax)/2;
    
      this.is.top=(y+ymax)/2;
    
      this.is.zIndex=(z+zmax)/2;
    
     }
    
     catch(err){
    
     alert("error ="+err+", x="+x+", y="+y+", z="+z+", k="+k+", bs="+bs+", top="+this.is.top+", left="+this.is.left+", width="+this.is.width+", height="+this.is.height);
    
     }
    
    }
    
    
    
    
    Code (markup):


    is=object.style



    http://huduzu.trollnest.com to see the error reported.
     
    Sleeping Troll, May 14, 2009 IP
  2. FilmFiddler

    FilmFiddler Greenhorn

    Messages:
    54
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    23
    #2
    Worth a try:

       
    this.is.width=2*bs + "px";
    this.is.height=2*bs + "px";
    this.is.left= Math.round((x+xmax)/2) + "px";
    this.is.top= Math.round((y+ymax)/2) + "px";
    this.is.zIndex= Math.round((z+zmax)/2);
    
    Code (markup):
     
    FilmFiddler, May 14, 2009 IP