Example Javascript
Executing Javascript from the Tree Explorer.

In this example we demonstrate how the tree explorer can be used to execute javascript functions within the current page. Within this page there is a simple piece of javascript which show's or hide's a table depending upon the supplied parameter. Here we have a tree with just two nodes one will execute the javascript to make the table visible and the second will execute the javascript to hide the table.

Note: If javascript is to be used then the "mayscript" element in the applet tag must be present and the target element of the item must be set to "javascript".

And here is applet html code,

<applet archive="Treemenu.jar" code="TreeApplet" width="200" height="180" mayscript>

<!-- Tree Properties -->
<param name="nodeOffset" value="25">
<param name="backgroundColor" value="255|255|150">
<param name="borderWidth" value="1">
<param name="borderColor" value="175|175|175">
<param name="connectingLines" value="true">
<param name="connectingLinesColor" value="100|100|100">
<param name="connectingLinesStyle" value="2">
<param name="highTextColor" value="255|255|255">
<param name="highBgColor" value="0|0|150">
<param name="nodegap" value="5">
<param name="title" value="Jpowered">
<param name="titleFont" value="Helvetica|BI|14">
<param name="titleColor" value="255|175|0">
<param name="underlineLinks" value="true">
<param name="scrollBarBgColor" value="255|175|0">
<param name="statusBar" value="true">
<param name="statusBarFont" value="Helvetica|N|12">
<param name="statusBarBgColor" value="255|175|0">
<param name="statusBarTextColor" value="0|0|0">
<param name="statusBarHeight" value="16">
<param name="highlightLastNodeClicked" value="false">

<!-- Images -->
<param name="image1" value="closed|./IconImages/closedfolder.gif">
<param name="image2" value="open|./IconImages/openfolder.gif">
<param name="image3" value="document|./IconImages/document.gif">
<param name="image4" value="point|./IconImages/point.gif">

<!-- Nodes -->
<param name="Nodedata" value="nodesjs.txt">
</applet>

And here is the Javascript function,

<SCRIPT LANGUAGE="JavaScript">

var table='hide';
function combo(table) {

if (table=='hide') {document.all.c1.style.visibility="hidden";}
if (table=='show') {document.all.c1.style.visibility="visible";}
}

</SCRIPT>

 

Return to example Index - click here.