SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Why does this throw an error in IE6?

    document.getElementById('current-img').style.top = Math.round(((290 / 2) - (imgH[i] / 2))) + 'px';

    imgH is a valid array, so its not due to an illegal division.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,047
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)

    error

    Is there an error message or is it not giving the results you want?

  3. #3
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It works fine in FF, but it says argument invalid in IE and it points to this line.

  4. #4
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wonshikee View Post
    document.getElementById('current-img').style.top = Math.round(((290 / 2) - (imgH[i] / 2))) + 'px';

    imgH is a valid array, so its not due to an illegal division.
    I suspect it doesn't like the '-' in 'current-img'.
    Tab-indentation is a crime against humanity.

  5. #5
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps, although imgH is a valid array, imgH[i] is not a valid array element, or not a valid number. Also, current-img must be a positioned element, but lacking that should prevent the function from operating in any browser.

    I'd suggest putting in an alert just before the line in question which displays the value of imgH[i] to determine its validity. Also, be aware that IE often misreports which line is at fault. Quite often the error is in the line preceding the one reported.
    Last edited by JVLB; Oct 27, 2007 at 16:53.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •