var op = -1; function setOpacity() { if( op < 10 ) { ++op; document.getElementById('big').style.opacity=op/10; setTimeout( setOpacity, 100 ); } }