Embed javascript in a template

Is it possible to embed javascript in an html template file? Or must it be done in the pascal code with asm..end?

It is possible but care must be taken wrt sequence of JavaScript in the HTML template vs the JavaScript of the Pascal application. Some careful organization might be needed.