| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Document |
JDocument |
addScript |
addScript() |
Never | Work in Progress |
Adds a linked script to the page
void addScript ( $url, $type )
| $url | string | is a string containing the URL to the linked script. |
| $type | string | is a string containg the type of script. This parameter is optional and if omitted defaults to ‘text/javascript’. |
The following example adds a linked script to the header of the current document.
Example
global $mainframe; $document = &JFactory::getDocument(); $document->addScript( JURI::base() . 'includes/js/overlib_mini.js' );
Might add the following to the head tag:
Result
<script type="text/javascript" src="http://127.0.0.1/joomla15/includes/js/overlib_mini.js"></script>