I need to edit my current create() function to include the below ConstructObject() and InitialiseScrollableArea(), in order to make my menus scrollable. What parameters would I pass the ConstructObject function?
Here is the call to create: create(document.all,tree) where tree is a multilevel array with all the text for the menus.
function InitialiseScrollableArea(){
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
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;
}
function _create(e,ary){
var str = new String();
var strNewP
var menuId = _menus.length;
str = '<DIV ID="_div_'
+ menuId
+ '" STYLE="visibility:hidden;position:absolute;top:0;left:0;width:'
+ e.attribs["width"]
+ ';height:10;background-color:black;">';
e.insertAdjacentHTML("AfterEnd",str);
var thismenu = document.all.item("_div_" + menuId);
_menus[menuId] = thismenu;
thismenu.menuId = menuId;
thismenu.close = _close;
thismenu.menuParent = null;
thismenu.menuChild = null;
thismenu.highlightBG = e.attribs["highlight"];
thismenu.normalBG = e.attribs["background"];
thismenu.menuOffset = e.attribs["menu-offset"];
thismenu.menuTopoffset = e.attribs["menu-topoffset"];
thismenu.waitDelay = e.attribs
for(var i=0;i<ary.length;i++){
str = '<SPAN ID="_link_'
+ menuId
+ '_'
+ i
+ '" STYLE="position:absolute;top:'
+ prevBottom
+ ';left:0;height:'
+ e.attribs["height"]
+ ';overflow:hidden;width:'
+ e.attribs["width"]
+ ';background:'
+ e.attribs["background"]
+ ';border-width:'
+ e.attribs["border-width"]
+ ';border-style:solid;border-color:'
+ e.attribs["border-color"]
+ ';';
if(e.attribs["showrow"]!=true && i != 0){
str +='border-top-width:0;';
}
str +='text-align:left;font-size:'
+ e.attribs["font-size"]
+ ';padding-left:4;">';
if(ary.icon!=null){
str +='<SPAN STYLE="font-family:webdings;color:'
+ e.attribs["icon-color"]
+ '">&#'
+ ary.icon
+ ';</SPAN> ';
}
strNewP =' ';
if(ary.url=="http://help.archaio.com"){
strNewP ='" Target="New"';
}
str +='<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"'
+ ary.url
+ strNewP + ''
+ '" TITLE="'
+ ary.desc
+ '" STYLE="font-family:'
+ e.attribs["font-family"]
+ ';color:'
+ e.attribs["font-color"]
+ ';padding-left:3;">'
+ ary.name
+ '</A>';
if(ary.length > 0 && e.attribs["arrow"]){
str +='<SPAN STYLE="font-family:webdings;position:absolute;top:0;left:'
+ e.attribs["arrow-offset"]
+ ';width:'
+ (e.attribs["width"] - e.attribs["arrow-offset"])
+ ';overflow:hidden;color:'
+ e.attribs["icon-color"]
+ '">4</SPAN>';
}
str +='</SPAN>';
thismenu.insertAdjacentHTML("BeforeEnd",str);
thisoption = document.all.item('_link_' + menuId + '_' + i);
thisoption.menuId = menuId;
thisoption.onmouseover = _optionmouseover;
thisoption.onmouseout = _optionmouseout;
prevBottom = thisoption.style.pixelTop + (e.attribs["height"] - e.attribs["border-width"]);
if(ary.length > 0){
thisoption.menuChild=_menus.length;
_create(e,ary);
}
}
thismenu.style.pixelHeight = prevBottom;
}
Here is the call to create: create(document.all,tree) where tree is a multilevel array with all the text for the menus.
function InitialiseScrollableArea(){
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
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;
}
function _create(e,ary){
var str = new String();
var strNewP
var menuId = _menus.length;
str = '<DIV ID="_div_'
+ menuId
+ '" STYLE="visibility:hidden;position:absolute;top:0;left:0;width:'
+ e.attribs["width"]
+ ';height:10;background-color:black;">';
e.insertAdjacentHTML("AfterEnd",str);
var thismenu = document.all.item("_div_" + menuId);
_menus[menuId] = thismenu;
thismenu.menuId = menuId;
thismenu.close = _close;
thismenu.menuParent = null;
thismenu.menuChild = null;
thismenu.highlightBG = e.attribs["highlight"];
thismenu.normalBG = e.attribs["background"];
thismenu.menuOffset = e.attribs["menu-offset"];
thismenu.menuTopoffset = e.attribs["menu-topoffset"];
thismenu.waitDelay = e.attribs
for(var i=0;i<ary.length;i++){
str = '<SPAN ID="_link_'
+ menuId
+ '_'
+ i
+ '" STYLE="position:absolute;top:'
+ prevBottom
+ ';left:0;height:'
+ e.attribs["height"]
+ ';overflow:hidden;width:'
+ e.attribs["width"]
+ ';background:'
+ e.attribs["background"]
+ ';border-width:'
+ e.attribs["border-width"]
+ ';border-style:solid;border-color:'
+ e.attribs["border-color"]
+ ';';
if(e.attribs["showrow"]!=true && i != 0){
str +='border-top-width:0;';
}
str +='text-align:left;font-size:'
+ e.attribs["font-size"]
+ ';padding-left:4;">';
if(ary.icon!=null){
str +='<SPAN STYLE="font-family:webdings;color:'
+ e.attribs["icon-color"]
+ '">&#'
+ ary.icon
+ ';</SPAN> ';
}
strNewP =' ';
if(ary.url=="http://help.archaio.com"){
strNewP ='" Target="New"';
}
str +='<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"'
+ ary.url
+ strNewP + ''
+ '" TITLE="'
+ ary.desc
+ '" STYLE="font-family:'
+ e.attribs["font-family"]
+ ';color:'
+ e.attribs["font-color"]
+ ';padding-left:3;">'
+ ary.name
+ '</A>';
if(ary.length > 0 && e.attribs["arrow"]){
str +='<SPAN STYLE="font-family:webdings;position:absolute;top:0;left:'
+ e.attribs["arrow-offset"]
+ ';width:'
+ (e.attribs["width"] - e.attribs["arrow-offset"])
+ ';overflow:hidden;color:'
+ e.attribs["icon-color"]
+ '">4</SPAN>';
}
str +='</SPAN>';
thismenu.insertAdjacentHTML("BeforeEnd",str);
thisoption = document.all.item('_link_' + menuId + '_' + i);
thisoption.menuId = menuId;
thisoption.onmouseover = _optionmouseover;
thisoption.onmouseout = _optionmouseout;
prevBottom = thisoption.style.pixelTop + (e.attribs["height"] - e.attribs["border-width"]);
if(ary.length > 0){
thisoption.menuChild=_menus.length;
_create(e,ary);
}
}
thismenu.style.pixelHeight = prevBottom;
}