I read in a few places that setInterval and setTimeout don’t work in IE, but I’ve used them in IE 6,7 and 8, so what am I missing here? Is this some special condition? I’m not surprised IE causes a problem - I just want to know when it occurs.
It was suggested you have to quote and use brackets, such as setInterval(“myFunc()”,2000); but I tried it without and it still works - i.e. setInterval(myFunc,2000) works fine in IE 6, even. Oddly, I had trouble with this at one time and thought it was lack of quotes and brackets, but it now works all the time. Is it a bad idea to omit the quotes and brackets? Here’s a jQuery script for simple font expansion that works fine in IE6. I’m just wondering where the problem might arise:
<script type="text/javascript">
jQuery(function(){
var setint, cnt=0;
var target = jQuery('div#garble p');
var fontsize = parseFloat(target.css('font-size'));
function boobaw(){jQuery('#garble p').css('font-size',(fontsize+=1) + 'px');if(++cnt>15) clearInterval(setint)}
jQuery('button#clikme').click(function(){setint=setInterval(boobaw,500)});
});
</script>
<button id="clikme">clikme!</button>
<div id="garble"><p>grow me, please</p></div>