Call a custom javascript function in "Execute Javascript In Chrome/Safari"

Hi everyone.

I am a web developer. So I got this great KM helping me out. But I am stuck. This seems impossible?

Calling alert() or prompt() or any of the native javascript functions does work.
But calling MyCustomFunction() does not work, the function is not to be found.

Seems you can access the html elements though, but not the functions. Not even custom functions as you can see does work in the Web Inspector when debugging.

Anyone knows a solution. I got an nasty ugly solution at this time though. But not to my liking.