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
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- templates_and_scripts
Source code: variable ::template::body_handlers if {$identifier eq "anonymous"} { lappend body_handlers($event,anonymous) $script } else { # Even a one event handler needs to be added in a list # since all handlers, anonymous and specific are treated as a # list in blank-master.tcl set body_handlers($event,$identifier) [list $script] }XQL Not present: Generic, PostgreSQL, Oracle