I want the red box to be enlarged and then shrinked ,but the code underneath just makes it enlarge , please help me !!!!!
//calling the function in window.onload to make sure the HTML is loaded window.onload = function() { /* h and w are counters of height and width , and i set them all 0*/ var h = 0; var w = 0; var box = document.getElementById('box'); /* i'm trying to repeat function zoom every 10 milisecs */ var t = setInterval(zoom, 10); function zoom() { /* if h >=200 and w >= 200 , the function zoom will be stopped */ if(h >= 200 && w >=200) { clearInterval(t); } else { /* else height and width will increase and the output makes you fell like it is enlarging */ h += 5 ; w += 5 ; box.style.height = h; box.style.width = w; } } }; /* The code above only makes the red box enlarge , you know */ /* SO THE POINT IS HOW TO MAKE THE RED BOX SHRINK WHENEVER h =200 and w =200 */