IE Invalid Argument... sometimes

Discussion in 'Javascript' started by andrewferk@gmail.com, Apr 18, 2008.

  1. Guest

    The following code is stored inside a div element.

    Movable.prototype.moveTimer = function() {
    this.style.left = (this.offsetLeft - (this.posX - this.newX)) + "px";
    this.style.top = (this.offsetTop - (this.posY - this.newY)) + "px";
    this.posX = this.newX;
    this.posY = this.newY;
    }

    every 40 ms it is called by a timer.

    var self = this;
    this.timer = setInterval(function(){self.moveTimer()},40);

    It works all the time in Firefox. Sometimes in IE it says it gets an
    invalid argument here:

    -->|this.style.left = (this.offsetLeft - (this.posX - this.newX)) +
    "px";

    The code moves the div element with a mouse click and drag. After I
    get the error I can try to drag it again and it will drag. Sometimes
    it will not get the error. So it's like... random?

    Any help would be great. Thanks
     
    , Apr 18, 2008
    #1
    1. Advertising

  2. wrote:
    > The following code is stored inside a div element.
    >
    > Movable.prototype.moveTimer = function() {
    > this.style.left = (this.offsetLeft - (this.posX - this.newX)) + "px";
    > this.style.top = (this.offsetTop - (this.posY - this.newY)) + "px";
    > this.posX = this.newX;
    > this.posY = this.newY;
    > }
    >
    > every 40 ms it is called by a timer.
    >
    > var self = this;
    > this.timer = setInterval(function(){self.moveTimer()},40);
    >
    > It works all the time in Firefox. Sometimes in IE it says it gets an
    > invalid argument here:
    >
    > -->|this.style.left = (this.offsetLeft - (this.posX - this.newX)) +
    > "px";
    >
    > The code moves the div element with a mouse click and drag. After I
    > get the error I can try to drag it again and it will drag. Sometimes
    > it will not get the error. So it's like... random?


    Welcome to MSHTML. That said, you should not augment host objects; if you
    have the need to do that, use a wrapper object instead.


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
     
    Thomas 'PointedEars' Lahn, Apr 18, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    0
    Views:
    473
    John Saunders
    Aug 28, 2003
  2. Nehmo Sergheyev
    Replies:
    1
    Views:
    509
    Andrew Urquhart
    May 9, 2004
  3. Marcin Vorbrodt

    ::std sometimes needed, sometimes not

    Marcin Vorbrodt, Sep 16, 2003, in forum: C++
    Replies:
    24
    Views:
    768
    Jerry Coffin
    Sep 17, 2003
  4. Replies:
    1
    Views:
    507
    gkelly
    Nov 29, 2006
  5. Randy Smith
    Replies:
    2
    Views:
    453
    Randy Smith
    Apr 24, 2007
Loading...

Share This Page