function btn_refresh(btnName,btnValue) { var btn = document.getElementsByName(btnName); btn[0].disabled = true; btnIntervalId = window.setInterval("set_refresh_btn('"+btnName+"','"+btnValue+"')", 1000); } function set_refresh_btn(btnName,btnValue) { var btn = document.getElementsByName(btnName); btnSecond = btnSecond -1; if(btnSecond < 0){ btn[0].value = btnValue; window.clearInterval(btnIntervalId); btnSecond = refreshInterval; btn[0].disabled = false; } else{ btn[0].value = btnValue + '(' + btnSecond + ')'; } }