The problem is that you’re calling fade_div directly, and passing the result – which is undefined – into the setTimeout function, which will simply do nothing. It becomes more obvious when you write it out:
var result = fade_div('two_mill_anon') // undefined
setTimeout(result, 10000)
The solution is to return a new function that will get passed to setTimeout(), and remembers the id parameter by creating a closure:
function fade_div (id) {
return function () {
document.getElementById(id).style.opacity = 0
}
}
setTimeout(fade_div('two_mill_anon'), 10000);