Example Javascript
Executing Javascript from the Menu Bar.

In this example we demonstrate how the menu bar 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 menu bar with just two buttons 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 code="AWTpopupVmenuApplet.class" archive="AWTpopupSidemenu.jar" width="120" height="90" mayscript>

<!-- Start Up Parameters -->
<param name="startupmessage" value="Loading data please wait....">
<param name="startBGcolor" value="255,255,255">
<param name="startTXTcolor" value="0,0,0">

<!-- General Applet Parameters -->
<param name="OpenOnClick" value="false">
<param name="BackgroundSound" value="bgsound">

<!-- Root Menu parameters -->
<param name="rootButtonWidth" value="100"> <!-- button width -->
<param name="rootButtonHeight" value="30"> <!-- button height -->
<param name="rootGap" value="0"> <!-- gap between buttons -->
<param name="rootBorderEffect" value="1"> <!-- Border Effect -->
<param name="rootMouseoverEffect" value="2"> <!-- Border Effect mouseover -->
<param name="rootMouseclickEffect" value="2"> <!-- Border Effect mouseclick -->

<!-- Root Menu Button data -->
<param name="button1" value="Button One|submenu|Helvetica,N,12| | |57,156,255|0,64,128|0,97,193|170,213,255|0,97,193|170,213,255|home|home2| |3,3|30,20|0,64,128| | | ">

<!-- Sub Menu definitions -->
<!-- Menu ID | Font -->
<param name="menu1" value="submenu|Hevetica,N,12">

<!-- Sub Menu Item definitions -->
<!-- menu ID | Text | Submenu ID | Seperator | URL | Target | Audio Clip ID -->
<param name="item1" value="submenu|Show Table| |false|
combo('show')|javascript| ">
<param name="item2" value="submenu|Hide Table|submenu2|false|
combo('hide')|javascript| ">

<!-- Images -->
<param name="image1" value="home|./IconImages/home.gif">
<param name="image2" value="home2|./IconImages/home2.gif">

</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>