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.
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.9 For 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: Marc Laporte
,
Xavi
,
system
,
sylvie
,
Rick
and
lindon
.
Page last modified on Saturday 08 May, 2010 21:55:41 UTC by Marc Laporte
.
