Just as you can tag a passage stylesheet to have its contents treated as CSS style rules, you can use the script tag to include custom JavaScript in your story. All passages with this tag are executed when the page loads, which you can use as an opportunity to do two things:

The execution order of passages tagged script is not guaranteed.