The correct syntax would be:
<TEMACRO TERMBODY 'onunload="MyUnloadFunc()"'>
If you need to include quotes in your call to MyUnloadFunc,
you would "escape" the single quote, as in:
<TEMACRO TERMBODY 'onunload="MyUnloadFunc(\'Hello\')"'>
This is because the text literal you are including is a
single-quoted text literal. Screensurfer supports text
literals that are initiated with either a double or single
quote--if you then need to use the same character inside the
string, you need to escape it with the backslash.
Note that the onunload will be called EVERY page
change...you will then need to check WHY the page was
unloaded, and this might not be so easy?