references:joomla.framework:document:jdocument-addscriptdeclarationTable of Contents
addScriptDeclaration
Adds a script into the head block of the current page. Syntaxvoid addScriptDeclaration ( $content, $type )
ExamplesThis example adds a short script to the page. Example global $mainframe; $script = "alert( 'A script has been added to the page!' );"; $document = &JFactory::getDocument(); $document->addScriptDeclaration( $script ); Might add the following to the head of the document: Result <script type="text/javascript"> // <!-- alert( 'A script has been added to the page!' ); // --> </script> |


