window.on

window.on(evtNames,fn)

evtNamesOne or more space-separated event types

fnA function to execute when the event is triggered

Attach an event handler function for one or more events to the element

<script> window.on("click", function() { alert("clicked"); }) </script>

window.off

window.off(evtNames,fn)

evtNamesOne or more space-separated event types

fnA handler function previously attached for the event(s)

Remove an event handler.

<script> var fn = function() { alert("clicked"); } window.off("click", fn); </script>