regClientScript

Registers Client-side JavaScript - these scripts are loaded at the end of the page.

Usage:

string regClientScript($src); (show formatting legend)

This function will create the tags to include the given javascript file, or will insert a block of javascript code, immediately before the final </body> tag of this page. Using this function will allow you to use the javascript for the document that needs it, rather than having the scripts in the template for all documents, whether they need it or not.

Example

$src = "<script type='text/javascript'>
  runSlideShow('slides');
</script>";
$modx->regClientScript($src);

This will insert the entire block of text at the bottom of the page.