setTimeout does not work in IE

Posted on 2007-10-18
Last Modified: 2013-12-08
I'm about to bang my head against something real at at this point. Once again, MS proved you have to spend loads of time figuring things out, or simply go with only them.
Anyhow, I'm doing a simple thing that resizes an image on mouseover/out, and I just don't get at this point why it would not work in IE.. The idea is: have N id'd images on the page, a class for an image with some props, and a manager class that deals with them. Now, this works perfectly in FF (NS then too, havent gotten to Safari/Opera yet) - even better than I expected. IE, however, seems to call the function being passed to setTimeout only one time, and then no js errors, nothing, it's like it quits. Very needed advise is absolutely appreciated!
You can see the code live at
Another thing, although that's rather dhtml/css, is that I've tried to position them images vertically centered, and it works with a table at the first run and relative positioning, but after mouseover it pulls to the top...
Question by:luefher
    LVL 75

    Accepted Solution

    It is not that black and white.
    It is a matter of do what I mean, not what I say.

    You are not saying what you mean to the browser.

    setTimeout works like eval if you do not put the statement in quotes:

    have a look:


    function bla() {
      return "alert('bla')"


    function bla1(str) {

    tId2=setTimeout('bla1("Hello there")',3000)

    LVL 75

    Expert Comment

    by:Michel Plungjan
    There are more...

    IE also understands px, it is more forgiving than FF so you MUST use px in FF
    but you CAN use px too in IE so you can change
    return px + (luefher_isIE ? '' : 'px');
    return px + 'px';

    LVL 75

    Expert Comment

    by:Michel Plungjan
    self is reserved word and cannot be passed in a function by name

    Author Comment

    figured that, mplungjan :)
    just tired of spending time on figuring out what it is ms thought of again :)
    see later post :)

    Author Comment

    to mplungjan - no it doesn't understand 'px' - don't know why... it understands it later, but if you remove luefher_iePix(int) it says wrong argument on the first run...

    Author Comment

    self - i didn;t know that. damn.
    anyhow, the whole problem was timer with oop, trying to get it ro pass an object. found a good js class here:
    works like charm!

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    #Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
    Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
    In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
    Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now