DOM troubles?

Maybe the error is due to where I'm calling my js file