template::add_body_handler (public)

 template::add_body_handler -event event -script script \
    [ -identifier identifier ]

Defined in packages/acs-templating/tcl/head-procs.tcl

Adds JavaScript code to an event handler in the body tag. Several JavaScript code blocks may be assigned to each handler by subsequent calls to template::add_body_handler.

If your script may only be added once you may supply an identifier. Subsequent calls to template::add_body_handler with the same identifier will replace your script rather than appending to it.

event may be one of:

  • onload
  • onunload
  • onclick
  • ondblclick
  • onmousedown
  • onmouseup
  • onmouseover
  • onmousemove
  • onmouseout
  • onkeypress
  • onkeydown
  • onkeyup

Switches:
-event (required)
the event during which the supplied script should be executed
-script (required)
the JavaScript code to execute
-identifier (optional, defaults to "anonymous")
a name, if supplied, used to ensure this JavaScript code is only added to the handler once

Testcases:
templates_and_scripts
[ show source ]
Show another procedure: