Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2054
  • Last Modified:

setTimeout does not work in IE

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 http://www.luefher.com/images/ebay/templates/clean-blue/template.html.
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...
0
luefher
Asked:
luefher
  • 3
  • 3
1 Solution
 
Michel PlungjanIT ExpertCommented:
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:

<script>

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

tId1=setTimeout(bla(),2000)

function bla1(str) {
  alert(str)
}

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

</script>
0
 
Michel PlungjanIT ExpertCommented:
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');
to
return px + 'px';

0
 
Michel PlungjanIT ExpertCommented:
self is reserved word and cannot be passed in a function by name
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
luefherAuthor Commented:
figured that, mplungjan :)
just tired of spending time on figuring out what it is ms thought of again :)
see later post :)
0
 
luefherAuthor Commented:
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...
0
 
luefherAuthor Commented:
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: http://devedge-temp.mozilla.org/toolbox/examples/2003/CCallWrapper/index_en.html
works like charm!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now