onclick funcion code example
Example: javascript button onclick
document.getElementById('button').onclick = function() {
alert("button was clicked");
};
document.getElementById('button').onclick = function() {
alert("button was clicked");
};