hook_onload

Definition

hook_onload()
developer/hooks/core.php, line 700

Description

Insert a JavaScript onload handler.

This hook enables modules to insert JavaScript into the body => onload event for every page view.

The returned statements will be automatically separated by semicolons, so including them in the returned array is optional.

Return value

An array of JavaScript statements to call during the onload event.

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_onload() {
  return array('my_javascript_function()');
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.