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 Quote 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 Quote 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 Quote 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? Quote Link to comment https://forums.phpfreaks.com/topic/152225-solved-adding-integer/#findComment-799447 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.