To call any JavaScript function from your markup, that function must be presented in your page in one of these ways:
1. Be part of the page inside a script block
2. To be linked to your page using script block with src attribute
If you do not do one of these you will get an 'undefined' error as the page can not find your function...
https://developer.mozilla.org/en/docs/Web/HTML/Element/script[
^]