Dovresti specificare anche "var" davanti all'oggetto, se non l'hai già fatto...

var ob = document.getElementById ("id");