<input id='test' type='button' value='Go' onclick="setOpen()" />
<script type="text/javascript">
function changeClick(){
alert('Changeded Click');
}
function setOpen(){
alert ("First Click");
var elem = document.getElementById('test');
if (!elem) return;
elem.removeAttribute("onclick");
elem.onclick = changeClick;
}
</script>