florida
10-27-2003, 10:14 AM
I have conditions that work but was hoping to shorten it in the "layerheader" part where I could concatenate the data results. Please advise.
This is current condtions that work:
if (condition here)
{
if((this.gtSysID >= 3) && (this.gtSysID <= 7 ))
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ' + (this.y - 16) + ';">';
}
else if((this.gtSysID >= 8) && (this.gtSysID <= 11 ))
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ' + (this.y - 20) + ';">';
}
//alot more else ifs continue here
My attempt to shorten the condition here not working:
if (condition here)
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ';
if((this.gtSysID >= 3) && (this.gtSysID <= 7 ))
{
layerHeader += ' + (this.y - 16) + ';">';
}
else if((this.gtSysID >= 8) && (this.gtSysID <= 11 ))
{
layerHeader += ' + (this.y - 20) + ';">';
}
//alot more else ifs continue here
This is current condtions that work:
if (condition here)
{
if((this.gtSysID >= 3) && (this.gtSysID <= 7 ))
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ' + (this.y - 16) + ';">';
}
else if((this.gtSysID >= 8) && (this.gtSysID <= 11 ))
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ' + (this.y - 20) + ';">';
}
//alot more else ifs continue here
My attempt to shorten the condition here not working:
if (condition here)
{
layerHeader = '<div id=menu' + this.ID + ' style="background: ; width: ' + this.width + '; visibility: hidden; position: absolute; left: ' + this.x + '; top: ';
if((this.gtSysID >= 3) && (this.gtSysID <= 7 ))
{
layerHeader += ' + (this.y - 16) + ';">';
}
else if((this.gtSysID >= 8) && (this.gtSysID <= 11 ))
{
layerHeader += ' + (this.y - 20) + ';">';
}
//alot more else ifs continue here