yaragallamurali Posted October 2, 2013 Share Posted October 2, 2013 Hi in my javascript i need to increase an int value by one after every 5 seconds. How to do this? Link to comment Share on other sites More sharing options...
davej Posted October 2, 2013 Share Posted October 2, 2013 (edited) <!DOCTYPE html><html><head><meta charset="utf-8"><title>title</title><script>count = 0;window.onload = init;function init() {window.setInterval(incre,5000);}function incre(){count++;document.getElementById('out').innerHTML = 'count is '+count;}</script></head><body><div id="out">count is 0</div></body></html> Edited October 2, 2013 by davej Link to comment Share on other sites More sharing options...
yaragallamurali Posted October 2, 2013 Author Share Posted October 2, 2013 <!DOCTYPE html><html><head><meta charset="utf-8"><title>title</title><script>count = 0;window.onload = init;function init() {window.setInterval(incre,5000);}function incre(){count++;document.getElementById('out').innerHTML = 'count is '+count;}</script></head><body><div id="out">count is 0</div></body></html> Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now