csckid Posted April 2, 2009 Share Posted April 2, 2009 function trans(){ setInterval("animate()",100); } i=0.0; x=0; function animate(){ i=i+.1; if((.1+i)>1) return; x=parseInt(x)+10; alert(x); a=document.getElementById('menu'); a.style.opacity=0.1+i;//a.filters.alpha.opacity=10+parseInt(x); } in alert box value of x shown is NaN, it is not adding integer plz help Link to comment https://forums.phpfreaks.com/topic/152225-solved-adding-integer/ Share on other sites More sharing options...
Adam Posted April 2, 2009 Share Posted April 2, 2009 The only thing I can think of is that trans() is being called before i and x are being set. Try moving: i=0.0; x=0; ... to the very top of your script, or adding it to the 'window.onload' event (Though you'd still need to declare them as globals). Adam Link to comment https://forums.phpfreaks.com/topic/152225-solved-adding-integer/#findComment-799383 Share on other sites More sharing options...
csckid Posted April 2, 2009 Author Share Posted April 2, 2009 Thanks it worked Link to comment https://forums.phpfreaks.com/topic/152225-solved-adding-integer/#findComment-799437 Share on other sites More sharing options...
Adam Posted April 2, 2009 Share Posted April 2, 2009 Excellent! Mind just marking the topic as solved? Link to comment https://forums.phpfreaks.com/topic/152225-solved-adding-integer/#findComment-799447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.