ActiveX Menu

[Total: 0    Average: 0/5]

This creates menus from form text buttons.

Head Code:

<SCRIPT LANGUAGE="JavaScript">

/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */

function makeItem (desc, url) {
this.desc = desc;
this.url = url;
}

function newItem(desc, url) {
menuItems[num] = new makeItem (desc, url)
Pop2.AddItem(menuItems[num].desc)
num++;
}

function newCat(desc) {
Pop1.AddItem(desc)
}

function Pop1_Click(item) {
num = 0;
        for (i = menuItems.length; i > 0 ; i--) Pop2.RemoveItem(i)
        if (item == 1) {
        newItem ('Page 1 A', '/');
        newItem ('Page 1 B', '/');
        newItem ('Page 1 C', '/');
        newItem ('Page 1 D', '/');
        newItem ('Page 1 E', '/');
        }
        if (item == 2) {
        newItem ('Page 2 A', '/');
        newItem ('Page 2 B', '/');
        newItem ('Page 2 C', '/');
        }
        if (item == 3) {
        newItem ('Page 3 A', '/');
        newItem ('Page 3 B', '/');
        newItem ('Page 3 C', '/');
        }
        if (item == 4) {
        newItem ('Page 4 A', '/');
        newItem ('Page 4 B', '/');
        newItem ('Page 4 C', '/');
        newItem ('Page 4 D', '/');
        }
}

function Pop2_Click(item) {
        if (menuItems[item - 1].url != null) window.location = menuItems[item - 1].url;
}

function init_this() {

newCat ('Cat 1');
newCat ('Cat 2');
newCat ('Cat 3');
newCat ('Cat 4');

newItem ('Cat 1 A', '/');
newItem ('Cat 1 B', '/');
newItem ('Cat 1 C', '/');
newItem ('Cat 1 D', '/');
newItem ('Cat 1 E', '/');
}

var num = 0;
var menuItems = new Array();
var menuCats = new Array();

</SCRIPT>
<OBJECT 
 ID = "Pop1"
 WIDTH = 0
 HEIGHT = 0
 CODEBASE="http://activex.microsoft.com/controls/iexplorer/iemenu.ocx#Version=4,70,0,1161"
 CLASSID="CLSID:7823A620-9DD9-11CF-A662-00AA00C066D2">
        <PARAM NAME="enable" VALUE="1">
        <PARAM NAME="ScreenX" VALUE="400">
        <PARAM NAME="ScreenY" VALUE="400">
</OBJECT>

<OBJECT 
 ID = "Pop2"
 WIDTH = 0
 HEIGHT = 0
 CODEBASE="http://activex.microsoft.com/controls/iexplorer/iemenu.ocx#Version=4,70,0,1161"
 CLASSID="CLSID:7823A620-9DD9-11CF-A662-00AA00C066D2">
        <PARAM NAME="enable" VALUE="1">
        <PARAM NAME="ScreenX" VALUE="400">
        <PARAM NAME="ScreenY" VALUE="400">
</OBJECT>

Body Code:

<FORM>
<INPUT TYPE="BUTTON" NAME="Category" VALUE="Category" onClick = "Pop1.PopUp()">
<INPUT TYPE="BUTTON" NAME="Page" VALUE="Page" onClick = "Pop2.PopUp()">
</FORM>
<script>
init_this();
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *