JlynnMc10
02-12-2003, 10:02 PM
This menu script is kicking my butt and I could use any help. My menu works but I would like to make it scrollable, and I think I have the code needed to do it but I cant get it to work. Is this even possible or am I walking down a dead end road???
//creates my menus (6 menus each with 2 sublevels)
function _init(){
for(var i=0;i<document.all.length;i++){
if(document.all[i].getAttribute("menu")){
var attribs = _eat_attrib(document.all[i].getAttribute("menu"));
var tree = new Array();
var src = document.all.item(attribs["src"]).innerText;
src = _strip(src);
tree = _compile(tree,src); //takes the scr data and stores all of the menu data in an array called tree
var menuId = _menus.length;
document.all[i].menuId = menuId;
document.all[i].onmouseover = _rootmouseover;
document.all[i].onmouseout = _rootmouseout;
//below sets up my current menus
//I think this is where I should create the scrollable menu
//object but I don't know what parameter to pass the
//constructobject function because I don't understand that
//function (see below)
//doesn't work
objContainer=new ConstructObject('attribs');
var attribs = _eat_attrib(document.all[i].getAttribute("menu"));
attribs["border-width"] = (attribs["border-width"]!=null?attribs["border-width"]:1);
attribs["border-color"] = (attribs["border-color"]!=null?attribs["border-color"]:"black");
attribs["background"] = (attribs["background"]!=null?attribs["background"]:"#9C9A9C");
attribs["highlight"] = (attribs["highlight"]!=null?attribs["highlight"]:"#336699");
attribs["font-size"] = (attribs["font-size"]!=null?attribs["font-size"]:"10");
attribs["font-family"] = (attribs["font-family"]!=null?attribs["font-family"]:"verdana");
attribs["font-color"] = (attribs["font-color"]!=null?attribs["font-color"]:"White");
attribs["icon-color"] = (attribs["icon-color"]!=null?attribs["icon-color"]:"black");
attribs["arrow"] = (attribs["arrow"]!=null?attribs["arrow"]:true);
attribs["showrow"] = (attribs["showrow"]!=null?attribs["showrow"]:true);
attribs["height"] = (attribs["height"]!=null?attribs["height"]:22);
attribs["width"] = (attribs["width"]!=null?attribs["width"]:150);
attribs["arrow-offset"] = (attribs["arrow-offset"]!=null?Number(attribs["arrow-offset"]):135);
attribs["menu-offset"] = (attribs["menu-offset"]!=null?Number(attribs["menu-offset"]):1);
attribs["menu-topoffset"] = (attribs["menu-topoffset"]!=null?Number(attribs["menu-topoffset"]):0);
attribs["wait"] = (attribs["wait"]!=null?Number(attribs["wait"]):1000);
document.all[i].attribs = attribs;
//tree is a multilevel array that contains all of the menu data and
//create associates the data to the menu
_create(document.all[i],tree);
//need to create objScroller and pass it the menu and the data
//I don't know what to pass as parameters
//I think the attribs and maybe the create function data???
objScroller=new ConstructObject()
objScroller.MoveArea(0,0)
objContainer.css.visibility='visible'
initialised=true;
}
}
}
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el = document.getElementById( obj );
this.css = this.el.style;
this.scrollHeight = this.el.offsetHeight
this.clipHeight = this.el.offsetHeight
this.up = MoveAreaUp;
this.down = MoveAreaDown;
this.MoveArea = MoveArea;
this.x;
this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this;
}
:confused: :confused: :confused: HELP!!!!
//creates my menus (6 menus each with 2 sublevels)
function _init(){
for(var i=0;i<document.all.length;i++){
if(document.all[i].getAttribute("menu")){
var attribs = _eat_attrib(document.all[i].getAttribute("menu"));
var tree = new Array();
var src = document.all.item(attribs["src"]).innerText;
src = _strip(src);
tree = _compile(tree,src); //takes the scr data and stores all of the menu data in an array called tree
var menuId = _menus.length;
document.all[i].menuId = menuId;
document.all[i].onmouseover = _rootmouseover;
document.all[i].onmouseout = _rootmouseout;
//below sets up my current menus
//I think this is where I should create the scrollable menu
//object but I don't know what parameter to pass the
//constructobject function because I don't understand that
//function (see below)
//doesn't work
objContainer=new ConstructObject('attribs');
var attribs = _eat_attrib(document.all[i].getAttribute("menu"));
attribs["border-width"] = (attribs["border-width"]!=null?attribs["border-width"]:1);
attribs["border-color"] = (attribs["border-color"]!=null?attribs["border-color"]:"black");
attribs["background"] = (attribs["background"]!=null?attribs["background"]:"#9C9A9C");
attribs["highlight"] = (attribs["highlight"]!=null?attribs["highlight"]:"#336699");
attribs["font-size"] = (attribs["font-size"]!=null?attribs["font-size"]:"10");
attribs["font-family"] = (attribs["font-family"]!=null?attribs["font-family"]:"verdana");
attribs["font-color"] = (attribs["font-color"]!=null?attribs["font-color"]:"White");
attribs["icon-color"] = (attribs["icon-color"]!=null?attribs["icon-color"]:"black");
attribs["arrow"] = (attribs["arrow"]!=null?attribs["arrow"]:true);
attribs["showrow"] = (attribs["showrow"]!=null?attribs["showrow"]:true);
attribs["height"] = (attribs["height"]!=null?attribs["height"]:22);
attribs["width"] = (attribs["width"]!=null?attribs["width"]:150);
attribs["arrow-offset"] = (attribs["arrow-offset"]!=null?Number(attribs["arrow-offset"]):135);
attribs["menu-offset"] = (attribs["menu-offset"]!=null?Number(attribs["menu-offset"]):1);
attribs["menu-topoffset"] = (attribs["menu-topoffset"]!=null?Number(attribs["menu-topoffset"]):0);
attribs["wait"] = (attribs["wait"]!=null?Number(attribs["wait"]):1000);
document.all[i].attribs = attribs;
//tree is a multilevel array that contains all of the menu data and
//create associates the data to the menu
_create(document.all[i],tree);
//need to create objScroller and pass it the menu and the data
//I don't know what to pass as parameters
//I think the attribs and maybe the create function data???
objScroller=new ConstructObject()
objScroller.MoveArea(0,0)
objContainer.css.visibility='visible'
initialised=true;
}
}
}
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el = document.getElementById( obj );
this.css = this.el.style;
this.scrollHeight = this.el.offsetHeight
this.clipHeight = this.el.offsetHeight
this.up = MoveAreaUp;
this.down = MoveAreaDown;
this.MoveArea = MoveArea;
this.x;
this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this;
}
:confused: :confused: :confused: HELP!!!!