Introduction: This is a detailed page on how to add JavaScript to the joomla template. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 332631 'rolling = 'no'>
This articleArticleIt is mainly for those who do not know much about PhP, hmtl and javascriptr. It tells you how to easily add JavaScript to the template using joomla1.5 API cballs.
Use the followingCodeAdd the path of the Javascript library file/Media/system/JS/sample. js to the template:
View Source
Print?
1. <? PHP
2. $ document = & jfactory: getdocument ();
3. $ document-> addscript ('/Media/system/JS/sample. js ');
4.?>
You can also use the JHTML method to add a Javascript file:
View Source
Print?
1. <? PHP
2. $ filename = 'filename. js ';
3. $ Path = 'path/to/file/'; // Add the path parameter if the path is different than: 'Media/system/JS /'
4. jhtml: script ($ filename, $ PATH );
5.?>
The third parameter is a Boolean value. If you want to load mootools (a concise, modular, and object-oriented JavaScript framework. It helps you to write scalable and compatible JavaScript code more quickly and easily.) set this value to true.
View Source
Print?
1. <? PHP
2. $ filename = 'filename. js ';
3. $ Path = 'path/to/file/'; // Add the path parameter if the path is different than: 'Media/system/JS /'
4. jhtml: script ($ filename, $ path, true); // mootools will load if it is not already loaded
5.
6.?>
Note: version 1.6 may be different.
From: http://www.lamp99.com/joomla/how-to-add-javascript-to-a-joomla-template-to/
More articles about how to add JavaScript to the joomla Template
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/332631.html pageno: 11.