dropmenuobj.style.left=dropmenuobj.style.top=-500 and change it to this: Code: dropmenuobj.style.left=dropmenuobj.style.top=-500+'px'