Fullscreen
[Show/Hide Right Column]

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.

Image


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.


alias

Contributors to this page: Marc Laporte8141 points  , lindon5651 points  , Xavi64467 points  , sylvie7154 points  , Rick21655 points  and system .
Page last modified on Saturday 08 May, 2010 21:55:41 UTC by Marc Laporte8141 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki