Include Javascript code or files ina wiki page
PluginJS
Use the JS plugin to include Javascript files or Javascript code in a wiki page. You can also use PluginHTML to embed Javascript in a page.Install
Starting in version 3.0, it is bundled. You just need to activate.For previous versions, see Mods Admin for instructions on how to install a Mod. The plugin can be found in the Mods. The source can also be found on the sourceforge http://tikiwiki.cvs.sourceforge.net/tikiwiki/_mods/wiki-plugins/js/wiki-plugins/
Usage
Once installed, you will see some new lines under the Wiki "edit > wiki help > Show Plugins Help":Insert a javascript file or/and some javascript code.
{JS(file='file.js')}javascript code{JS}The file.js file is in this case in the tikiwiki root.
This will produce the following code for your Tiki:
<script type="text/javascript" src="file.js"></script>Note that it has to be surrounded by quotes.
{JS(file="http://www.foo.com/tiki.js")}{JS}Example 1
To include Javascript code, use:{JS()}
var....
function ...
...
{JS}This will produce the following code for your Tiki:
<script type="text/javascript"> var.... function ... ...</script>Note: the file is inserted before the param, if you need the reverse order use 2 calls to the JS plugins
Example 2
{JS()}alert('coucou'){JS}Would produce a pop up window that the user would have to click on "Accept" button ("D'acord" in this localized example) to make it disappear.

Note
Note: Some javescript are modified for security reasons. in 1.9For instance you need to use
document.write('<form name="form" method="" action="" on');
document.write('Submit="return verif_champs( );">'); not to have onsubmit transformed.
Contributors to this page: lindon
,
marclaporte
,
ricks99
,
Xavi
,
sylvie
and
system
.
Page last modified on Saturday 06 March, 2010 04:01:26 UTC by lindon
.
Sidebar
Sidebar
To register
To have an account at this site, please register at Tikiwiki.org
, and then use that user name and password to log in here.
