javascript change button onclick

JavaScript
function Bar() {
  document.getElementById("a").onclick = Foo();
}
Source

Also in JavaScript: