PDA

View Full Version : How can ConstructObject have different number of parameters?


JlynnMc10
02-10-2003, 03:24 PM
How can the ConstructObject function have different number of parameters? Also what is nest?

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;
}

mordred
02-10-2003, 03:39 PM
Originally posted by JlynnMc10
How can the ConstructObject function have different number of parameters?

That's how JavaScript works, you can pass as many arguments to a function (also constructor functions) as you want.


Also what is nest?


It's your script, you probably know best what it's used for. I think it's for creating some sort of nested menu or a similar element structure.

JlynnMc10
02-10-2003, 04:17 PM
Could I edit InitialiseScrollableArea and ConstructObject (see above) somehow so that they would work on a menu that is already created. I already have a .js that creates the menus and puts the correct data in them, and I would like to just make a scrollable menu if after a menu is created and the data is greater than a given number.