function closebar(){ document.cookie="remainclosed=1"; document.getElementById("topbar").style.visibility="hidden"; } Code (markup): This is HTML code: <a href="" onClick="closebar(); return false">Close [x]</a> Code (markup): but when I click on that link it hide IM ad and show it again. Can anyone help me with this? Also need help to minimize code.