[Solved] Is it possible to call a function in javascript?

Is it possible to create a event that call a function in javascript?
Like the picture shows.

I use window scope to declare variables globally.
: )