Functions can be called from a html tag with the onclick event on Buttons or Links

<button onclick="alert('Boo!');">Click me</button>

Here the onclick event calls the javascript alert function. alert('Boo!')

 

Click me

<a href="#" onclick="alert('Boo!');">Click me</a>

 

Because onclick = " " is an attribute of the button element we have to use ' ' (single quotes)