?
Solved

error dynlayer.js ''ref.layers has no properties''

Posted on 2003-03-06
37
Medium Priority
?
366 Views
Last Modified: 2011-09-20
my menu list button does not function in netscape 7.0 but work perfectly well in IE..error on dynlayers.js line 77 ref.layers has no properties.

// DynLayerInit Function
function DynLayerInit(nestref) {
     if (!DynLayer.set) DynLayer.set = true
     if (is.ns) {
          if (nestref) ref = eval('document.'+nestref+'.document')
          else {nestref = ''; ref = document;}
          for (var i=0; i<ref.layers.length; i++) {
               var divname = ref.layers[i].name
               DynLayer.nestRefArray[divname] = nestref
               var index = divname.indexOf("Div")
               if (index > 0) {
                    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
               }
               if (ref.layers[i].document.layers.length > 0) {
                    DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
               }
          }
          if (DynLayer.refArray.i < DynLayer.refArray.length) {
               DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
          }
     }
     else if (is.ie) {
          for (var i=0; i<document.all.tags("DIV").length; i++) {
               var divname = document.all.tags("DIV")[i].id
               var index = divname.indexOf("Div")
               if (index > 0) {
                    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
               }
          }
     }
     return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
0
Comment
Question by:hernaezia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 17
  • 13
  • 6
  • +1
37 Comments
 
LVL 5

Expert Comment

by:gator4life
ID: 8086267
Is this line 77?

     for (var i=0; i<ref.layers.length; i++) {

I am assuming that it is.  That means that ref has to be the result of this:

     if (nestref) ref = eval('document.'+nestref+'.document')
         else {nestref = ''; ref = document;}

The first thing I would do is change the syntax a little to ensure that it is interpreting this properly, since the if statement is not delimited from the else statement by anything (neither a {} or ;). So, first change the code to:

     if (nestref) {ref = eval('document.'+nestref+'.document');}
         else {nestref = ''; ref = document;}

If that does not help, then I will need to know what "nestref" is being passed as a value, since I don't think the else is the problem...document.layers.length would be correct, so the if has to be the problem area.

gator4life
(chomp, chomp)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8086743
The reason why it won't work in Netscape 7 is because the code you are using within if (is.ns) is Netscape 4 and lower syntax!!

You need to change your browser sniffer, and introduce a 3rd option: isdom

[this can be done with something like:

if (document.getElementById) isdom = true;  ]

Then add another if statement:

else if (isdom) {
  for (var i=0; i<document.getElementByTagname("DIV").length; i++) {
    var divname = document.getElementByTagname("DIV")[i].id
    var index = divname.indexOf("Div")
    if (index > 0) {
      eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
    }
  }
}
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8086808
Ya know, I didn't even catch that...  Thanks kasandra; should save him/her a lot of time. ;-)

gator4life
(chomp, chomp)
0
[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

 
LVL 5

Expert Comment

by:kasandra
ID: 8099821
Thanks for the nice comment gator4life! I really appreciate that :)
0
 

Author Comment

by:hernaezia
ID: 8108345
Hi guys i've tried both of your solutions but still it doesnt work.This is what my dynlayer.js looked like after I've edited the source code.

// DynLayerInit Function
function DynLayerInit(nestref) {
     if (!DynLayer.set) DynLayer.set = true
     if (is.ns) {
          if (nestref) {ref = eval('document.'+nestref+'.document');}
          else {nestref = ''; ref = document;}
          for (var i=0; i<ref.layers.length; i++) {
               var divname = ref.layers[i].name
               DynLayer.nestRefArray[divname] = nestref
               var index = divname.indexOf("Div")
               if (index > 0) {
                    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
               }
               if (ref.layers[i].document.layers.length > 0) {
                    DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
               }
          }
          if (DynLayer.refArray.i < DynLayer.refArray.length) {
               DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
          }
          if (document.getElementById) isdom = true;
          else if (isdom)
          {
                for (var i=0; i<document.getElementByTagname("DIV").length; i++)
                {
                       var divname = document.getElementByTagname("DIV")[i].id
                       var index = divname.indexOf("Div")
                  if (index > 0)
                   {
                    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
                }
             }      
          }

}
     else if (is.ie) {
          for (var i=0; i<document.all.tags("DIV").length; i++) {
               var divname = document.all.tags("DIV")[i].id
               var index = divname.indexOf("Div")
               if (index > 0) {
                    eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
               }
          }
     }
     return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8108419
umm... what is your code for determining the values of is.ns and is.ie? (why have you got a dot in the variable name??)

Either way, you should not have the isdom part inside the is.ns part - instead you need something like:

if (document.getElementById) isdom = true;

// DynLayerInit Function
function DynLayerInit(nestref) {
  if (!DynLayer.set) DynLayer.set = true
 
  if (is.ns) {
    if (nestref) {
      ref = eval('document.'+nestref+'.document');
    }
    else {
      nestref = ''; ref = document;
    }
    for (var i=0; i<ref.layers.length; i++) {
      var divname = ref.layers[i].name
      DynLayer.nestRefArray[divname] = nestref
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
      }
      if (ref.layers[i].document.layers.length > 0) {
        DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
      }
    }
    if (DynLayer.refArray.i < DynLayer.refArray.length) {
       DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
    }
  }      
  else if (isdom) {
    for (var i=0; i<document.getElementByTagname("DIV").length; i++) {
      var divname = document.getElementByTagname("DIV")[i].id
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
      }
    }      
  }
  else if (is.ie) {
    for (var i=0; i<document.all.tags("DIV").length; i++) {
      var divname = document.all.tags("DIV")[i].id
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
      }
    }
  }
  return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8108500
"why have you got a dot in the variable name??"

I suspect that it is a custom object type that has been created in JavaScript with custom properties, like so:

function Browser() {

     this.dom = (document.getElementbyId) ? true : false;
     this.ie = (document.all) ? true : false;
     this.ns = (document.layers) ? true : false;
}

var is = new Browser();

Now I can refer to the properties, is.dom, is.ie, and is.ns.

gator4life
(chomp, chomp)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8108526
umm... what is your code for determining the values of is.ns and is.ie? (why have you got a dot in the variable name??)

Either way, you should not have the isdom part inside the is.ns part - instead you need something like:

if (document.getElementById) isdom = true;

// DynLayerInit Function
function DynLayerInit(nestref) {
  if (!DynLayer.set) DynLayer.set = true
 
  if (is.ns) {
    if (nestref) {
      ref = eval('document.'+nestref+'.document');
    }
    else {
      nestref = ''; ref = document;
    }
    for (var i=0; i<ref.layers.length; i++) {
      var divname = ref.layers[i].name
      DynLayer.nestRefArray[divname] = nestref
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
      }
      if (ref.layers[i].document.layers.length > 0) {
        DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
      }
    }
    if (DynLayer.refArray.i < DynLayer.refArray.length) {
       DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
    }
  }      
  else if (isdom) {
    for (var i=0; i<document.getElementByTagname("DIV").length; i++) {
      var divname = document.getElementByTagname("DIV")[i].id
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
      }
    }      
  }
  else if (is.ie) {
    for (var i=0; i<document.all.tags("DIV").length; i++) {
      var divname = document.all.tags("DIV")[i].id
      var index = divname.indexOf("Div")
      if (index > 0) {
        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
      }
    }
  }
  return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8108531
fair enough :)
(oops... not sure why it posted twice!)
0
 

Author Comment

by:hernaezia
ID: 8109111
Ok guys this is the whole code for dynlayer.js and ive tried putting the

if (document.getElementById) isdom = true;

outside the is.ns but still again the error is at 'line 77 ref.layers has no properties'

// Dynamic Layer Object
// sophisticated layer/element targeting and animation object which provides the core functionality needed in most DHTML applications
// 20021025
// Copyright (C) 2002 ESDC Technology

function DynLayer(id,nestref,frame) {
      if (!DynLayer.set && !frame) DynLayerInit()
      this.frame = frame || self
      if (is.ns) {
            if (is.ns4) {
                  if (!frame) {
                        if (!nestref) var nestref = DynLayer.nestRefArray[id]
                        if (!DynLayerTest(id,nestref)) return
                        this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
                  }
                  else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
                  this.elm = this.event = this.css
                  this.doc = this.css.document
            }
            if (is.ns5) {
                  this.elm = document.getElementById(id)
                  this.css = this.elm.style
                  this.doc = document
            }
            this.x = this.css.left
            this.y = this.css.top
            this.w = this.css.clip.width
            this.h = this.css.clip.height
      }
      else if (is.ie) {
            this.elm = this.event = this.frame.document.all[id]
            this.css = this.frame.document.all[id].style
            this.doc = document
            this.x = this.elm.offsetLeft
            this.y = this.elm.offsetTop
            this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
            this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
      }
      this.id = id
      this.nestref = nestref
      this.obj = id + "DynLayer"
      eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
      if (x!=null) {
            this.x = x
            if (is.ns) this.css.left = this.x
            else this.css.pixelLeft = this.x
      }
      if (y!=null) {
            this.y = y
            if (is.ns) this.css.top = this.y
            else this.css.pixelTop = this.y
      }
}
function DynLayerMoveBy(x,y) {
      this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
      this.css.visibility = (is.ns)? "show" : "visible"
}
function DynLayerHide() {
      this.css.visibility = (is.ns)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')

// DynLayerInit Function
function DynLayerInit(nestref) {
      if (!DynLayer.set) DynLayer.set = true
      if (is.ns) {
            if (nestref) {ref = eval('document.'+nestref+'.document');}
            else {nestref = ''; ref = document;}
            for (var i=0; i<ref.layers.length; i++) {
                  var divname = ref.layers[i].name
                  DynLayer.nestRefArray[divname] = nestref
                  var index = divname.indexOf("Div")
                  if (index > 0) {
                        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
                  }
                  if (ref.layers[i].document.layers.length > 0) {
                        DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
                  }
            }
            if (DynLayer.refArray.i < DynLayer.refArray.length) {
                  DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
            }
             
            else if (isdom)
            {
                   for (var i=0; i<document.getElementByTagname("DIV").length; i++)
                   {
                           var divname = document.getElementByTagname("DIV")[i].id
                           var index = divname.indexOf("Div")
                     if (index > 0)
                      {
                       eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
                }
             }      
          }

}
      else if (is.ie) {
            for (var i=0; i<document.all.tags("DIV").length; i++) {
                  var divname = document.all.tags("DIV")[i].id
                  var index = divname.indexOf("Div")
                  if (index > 0) {
                        eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
                  }
            }
      }
      return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

// Slide Methods
function DynLayerSlideTo(endx,endy,inc,speed,fn) {
      if (endx==null) endx = this.x
      if (endy==null) endy = this.y
      var distx = endx-this.x
      var disty = endy-this.y
      this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
      var endx = this.x + distx
      var endy = this.y + disty
      this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
      if (this.slideActive) return
      if (!inc) inc = 10
      if (!speed) speed = 10
      var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
      if (num==0) return
      var dx = distx/num
      var dy = disty/num
      if (!fn) fn = null
      this.slideActive = true
      this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
      if (!this.slideActive) return
      if (i++ < num) {
            this.moveBy(dx,dy)
            this.onSlide()
            if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
            else this.onSlideEnd()
      }
      else {
            this.slideActive = false
            this.moveTo(endx,endy)
            this.onSlide()
            this.onSlideEnd()
            eval(fn)
      }
}
DynLayerSlideInit = new Function()
DynLayer.prototype.slideInit = new Function()
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()

// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
      if (is.ie) {
            if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
            else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
      }
}
function DynLayerClipTo(t,r,b,l) {
      if (t==null) t = this.clipValues('t')
      if (r==null) r = this.clipValues('r')
      if (b==null) b = this.clipValues('b')
      if (l==null) l = this.clipValues('l')
      if (is.ns) {
            this.css.clip.top = t
            this.css.clip.right = r
            this.css.clip.bottom = b
            this.css.clip.left = l
      }
      else if (is.ie) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function DynLayerClipBy(t,r,b,l) {
      this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function DynLayerClipValues(which) {
      if (is.ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
      if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0])
      if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1])
      if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2])
      if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3])
}
DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues

// Write Method
function DynLayerWrite(html) {
      if (is.ns) {
            this.doc.open()
            this.doc.write(html)
            this.doc.close()
      }
      else if (is.ie) {
            this.event.innerHTML = html
      }
}
DynLayer.prototype.write = DynLayerWrite

// BrowserCheck Object
function BrowserCheck() {
      var b = navigator.appName
      if (b=="Netscape") this.b = "ns"
      else if (b=="Microsoft Internet Explorer") this.b = "ie"
      else this.b = b
      this.version = navigator.appVersion
      this.v = parseInt(this.version)
      this.ns = (this.b=="ns" && this.v>=4)
      this.ns4 = (this.b=="ns" && this.v==4)
      this.ns5 = (this.b=="ns" && this.v==5)
      this.ie = (this.b=="ie" && this.v>=4)
      this.ie4 = (this.version.indexOf('MSIE 4')>0)
      this.ie5 = (this.version.indexOf('MSIE 5')>0)
      this.min = (this.ns||this.ie)
}
is = new BrowserCheck()

// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
      if (id=="START") return '<STYLE TYPE="text/css">\n'
      else if (id=="END") return '</STYLE>'
      var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
      if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
      if (arguments.length>=5 && height!=null) {
            str += ' height:'+height+'px;'
            if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
      }
      if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
      if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
      if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
      if (arguments.length==9 && other!=null) str += ' '+other
      str += '}\n'
      return str
}
function writeCSS(str,showAlert) {
      str = css('START')+str+css('END')
      document.write(str)
      if (showAlert) alert(str)
}
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8109468
The browser check looks like it was written pre-DOM browsers, which, as I suspected, is your problem here.

I suggest trying something like this instead:

----- Place this at the top of dynlayers.js ------
----- and delete the function BrowserCheck() -----

var isDOM = (document.getElementById) ? true : false;
var isIE = (document.all) ? true : false;
var isNav = (document.layers) ? true : false;

---- Change you dynLayer function to: -------

// DynLayerInit Function
function DynLayerInit(nestref) {
 if (!DynLayer.set) DynLayer.set = true
 
 if (isNav) {
   if (nestref) {
     ref = eval('document.'+nestref+'.document');
   }
   else {
     nestref = ''; ref = document;
   }
   for (var i=0; i<ref.layers.length; i++) {
     var divname = ref.layers[i].name
     DynLayer.nestRefArray[divname] = nestref
     var index = divname.indexOf("Div")
     if (index > 0) {
       eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
     }
     if (ref.layers[i].document.layers.length > 0) {
       DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
     }
   }
   if (DynLayer.refArray.i < DynLayer.refArray.length) {
      DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
   }
 }      
 else if (isDOM) {
   for (var i=0; i<document.getElementByTagname("DIV").length; i++) {
     var divname = document.getElementByTagname("DIV")[i].id
     var index = divname.indexOf("Div")
     if (index > 0) {
       eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
     }
   }      
 }
 else if (isIE) {
   for (var i=0; i<document.all.tags("DIV").length; i++) {
     var divname = document.all.tags("DIV")[i].id
     var index = divname.indexOf("Div")
     if (index > 0) {
       eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
     }
   }
 }
 return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

----------------------------------------

... and you will need to likewise edit your other functions to replace is.ie and is.ns with the appropriate variable.

As a side note, I realise you are very new to EE and as such don't have very many points.. "easy" questions should be allocated 50 points. 20 points generally won't get you nearly as much help as we have been trying to give you...
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8109517
I was just about to suggest that you bring up the points in regards to this question.  After I saw all of that code posted, realized what it would take to make it work, and looked again at the number of points, I immediately moved on to another question...  Keep up the fight, kasandra.  You're doing good! ;-)

gator4life
(chomp, chomp)
0
 

Author Comment

by:hernaezia
ID: 8116644
Sorry guys..I'm in the process to increase the point as kasandra suggested in my other duplicate questions.Yes I'm new to EE and still fresh in this programming thing.By the way thanks kasandra for the suggestion and i still work on it as theres a lot of errors came out after the changes that being made regarding the undefined css and unterminated string literal..Wait for the points to be increased ok :)
0
 

Author Comment

by:hernaezia
ID: 8116706
Still handling the 3 new errors.css undefined,is is undefines and unterminated string literal..
0
 

Author Comment

by:hernaezia
ID: 8116756
Still handling the 3 new errors.css undefined,is is undefines and unterminated string literal..
0
 

Author Comment

by:hernaezia
ID: 8116778
Still handling the 3 new errors.css undefined,is is undefines and unterminated string literal..
0
 

Author Comment

by:hernaezia
ID: 8116890
Kasandra,my menu has been displayed but it doesnt work when i try to click it.The error is 'is is not defined' line 118 which is in this area
---------------------------------------------------------
else if (isIE) {
  for (var i=0; i<document.all.tags("DIV").length; i++) {
    var divname = document.all.tags("DIV")[i].id
    var index = divname.indexOf("Div")
    if (index > 0) {
      eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
    }
  }
}
---------------------------------------------

what should i defined the 'is'?
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8117093
hernaaezia -

If you did what kasandra told you to do from her last post, you should have deleted the function BrowserCheck().  In your code that you posted, the variable "is" was getting set to a new BrowserCheck object.  Whether you also deleted this line of code is besides the point.  However, in the code that you just posted, a new DynLayer object is trying to be created.  If you go and look at the DynLayer() function, it uses the "is" variable extensively, as well as many of the other functions.  Since you deleted BrowserCheck(), the variable "is" that these functions are trying to find is no longer available; hence the error: "is is not defined".  You need to recode all of the other functions to utilize the new isDOM, isNS, and isIE variables that kasandra created, but this looks like an extensive amount of work from what I am looking at.  Could you post the latest and greatest code you have with all of the changes you have made?

gator4life
(chomp, chomp)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8117134
that's better!

looking into it...
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8117151
that's better!

looking into it...
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8117178
oops.. the "Reload this Question" link doesn't appear to work in Opera 6, so if I press the "Reload" button on the browser it repeats my last post :( I really must start using Opera 7!! ;)

Ditto what gator4life said... I'm sorry if it wasn't clear in my previous comments that you would need to go through ALL your functions any update them appropriately. I wasn't prepared to do that for you for 20 points, but have started looking at it now that you have given a more appropriate point value.

Actually, there is a fair amount of work aside from that - in the cases where you do need to add in a 3rd case for DOM browsers, you need to know what is the appropriate thing to put - what is supported by Netscape 6 etc.

If you are going to be coding for Netscape 6 a lot, you will need to learn up on DOM browsers and what they support. We can give you some links which may help if you are interested.

;)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8117333
Give this a try... I haven't tested it though as I have no idea how you are using it!

var isDOM = (document.getElementById) ? true : false;
var isIE = (document.all) ? true : false;
var isNav = (document.layers) ? true : false;

// DynLayerInit Function
function DynLayerInit(nestref) {
  if (!DynLayer.set) DynLayer.set = true
    if (isNav) {
      if (nestref) ref = eval('document.'+nestref+'.document');
      else {
        nestref = '';
      ref = document;
      }
      for (var i=0; i<ref.layers.length; i++) {
        var divname = ref.layers[i].name
        DynLayer.nestRefArray[divname] = nestref
        var index = divname.indexOf("Div")
        if (index > 0) {
          eval(divname.substr(0,index)+' = new DynLayer("'+divname+'",
          "'+nestref+'")');
        }
        if (ref.layers[i].document.layers.length > 0) {
          DynLayer.refArray[DynLayer.refArray.length] = (nestref=='') ?
          ref.layers[i].name : nestref+'.document.'+ref.layers[i].name;
        }
      }
      if (DynLayer.refArray.i < DynLayer.refArray.length)
        DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++]);
    }
    else {
      if (isDOM) {
        upperlim = document.getElementByTagname("DIV").length;
        divname = document.getElementByTagname("DIV")[i].id;
      }
      else {
        upperlim = document.all.tags("DIV").length;
       divname = document.all.tags("DIV")[i].id;
      }
      for (var i=0; i < upperlim; i++) {
        var index = divname.indexOf("Div");
        if (index > 0)
          eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
      }      
    }
  }
  return true
}

function DynLayer(id,nestref,frame) {
  if (!DynLayer.set && !frame) DynLayerInit()
  this.frame = frame || self
  if (isIE) {
    this.elm = this.event = this.frame.document.all[id];
    this.css = this.frame.document.all[id].style;
    this.doc = document;
    this.x = this.elm.offsetLeft;
    this.y = this.elm.offsetTop;
    this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth;
    this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight;
   }
   else {
     if (isNav) {
       if (!frame) {
          if (!nestref) var nestref = DynLayer.nestRefArray[id];
          if (!DynLayerTest(id,nestref)) return;
          this.css = (nestref) ? eval("document."+nestref+".document."+id) :
          document.layers[id];
       }
       else this.css = (nestref) ? eval("frame.document." + nestref +
       ".document." + id) : frame.document.layers[id];
       this.elm = this.event = this.css;
       this.doc = this.css.document;
    }
    else if (isDOM) {
      this.elm = document.getElementById(id);
      this.css = this.elm.style;
      this.doc = document;
    }
    this.x = this.css.left
    this.y = this.css.top
    this.w = this.css.clip.width
    this.h = this.css.clip.height
  }
  this.id = id;
  this.nestref = nestref;
  this.obj = id + "DynLayer";
  eval(this.obj + "=this");
}

function DynLayerMoveTo(x,y) {
  if (x!=null) {
    this.x = x;
    if (isIE) this.css.pixelLeft = this.x;
    else this.css.left = this.x;
   }
   if (y!=null) {
     this.y = y;
     if (isIE) this.css.pixelTop = this.y;
     else  this.css.top = this.y;
   }
}

function DynLayerMoveBy(x,y) {
  this.moveTo(this.x+x,this.y+y)
}

function DynLayerShow() {
  this.css.visibility = (isNav) ? "show" : "visible"
}

function DynLayerHide() {
   this.css.visibility = (isNav) ? "hide" : "hidden"
}

// Slide Methods

function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
  if (this.slideActive) return;
  if (!inc) inc = 10;
  if (!speed) speed = 10;
  var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc;
  if (num==0) return;
  var dx = distx/num;
  var dy = disty/num;
  if (!fn) fn = null;
  this.slideActive = true;
  this.slide(dx,dy,endx,endy,num,1,speed,fn);
}

function DynLayerSlideTo(endx,endy,inc,speed,fn) {
  if (endx==null) endx = this.x;
  if (endy==null) endy = this.y;
  var distx = endx-this.x;
  var disty = endy-this.y;
  this.slideStart(endx,endy,distx,disty,inc,speed,fn);
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
  var endx = this.x + distx;
  var endy = this.y + disty;
  this.slideStart(endx,endy,distx,disty,inc,speed,fn);
}

function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
  if (!this.slideActive) return
  if (i++ < num) {
    this.moveBy(dx,dy);
    this.onSlide();
    if (this.slideActive) setTimeout(this.obj+".slide("+dx+", "+dy+",
      "+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed);
    else this.onSlideEnd();
  }
  else {
    this.slideActive = false;
    this.moveTo(endx,endy);
    this.onSlide();
    this.onSlideEnd();
    eval(fn);
  }
}

// Clip Methods

function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
  if (isIE) {
    if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft);
    else this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0);
  }
}

function DynLayerClipTo(t,r,b,l) {
  if (t==null) t = this.clipValues('t');
  if (r==null) r = this.clipValues('r');
  if (b==null) b = this.clipValues('b');
  if (l==null) l = this.clipValues('l');
  if (isIE) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
  else  {
    this.css.clip.top = t;
    this.css.clip.right = r;
    this.css.clip.bottom = b;
    this.css.clip.left = l;
  }
}

function DynLayerClipBy(t,r,b,l) {
  this.clipTo(this.clipValues('t')+t, this.clipValues('r')+r,
    this.clipValues('b')+b,this.clipValues('l')+l);
}

function DynLayerClipValues(which) {
  if (isIE)
    var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px");
  if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0]);
  if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1]);
  if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2]);
  if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3]);
}

// Write Method

function DynLayerWrite(html) {
  if (isNav) {
    this.doc.open();
    this.doc.write(html);
    this.doc.close();
  }
  else this.event.innerHTML = html;
}

// CSS Function

function css(id,left,top,width,height,color,vis,z,other) {
  if (id=="START") return '<STYLE TYPE="text/css">\n'
  else if (id=="END") return '</STYLE>'
  var str = (left!=null && top!=null) ?
    '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' :
    '#'+id+' {position:relative;'
  if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
  if (arguments.length>=5 && height!=null) {
    str += ' height:'+height+'px;'
    if (arguments.length<9 || other.indexOf('clip')==-1)
      str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
  }
  if (arguments.length>=6 && color!=null) str += (is.ns) ?
    ' layer-background-color:'+color+';' : ' background-color:'+color+';'
  if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
  if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
  if (arguments.length==9 && other!=null) str += ' '+other
  str += '}\n'
  return str
}

function writeCSS(str,showAlert) {
  str = css('START')+str+css('END')
  document.write(str)
  if (showAlert) alert(str)
}

// For testing purposes??

DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false

DynLayerSlideInit = new Function()
DynLayer.prototype.slideInit = new Function()
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()

DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues

DynLayer.prototype.write = DynLayerWrite
0
 

Author Comment

by:hernaezia
ID: 8124440
Gator4life, this is the latest code that i have edited.The error is 'is is not defined'.

-------------------------------------------------------

var DOM = (document.getElementById) ? true : false;
var IE = (document.all) ? true : false;
var Nav = (document.layers) ? true : false;

function DynLayer(id,nestref,frame) {
      if (!DynLayer.set && !frame) DynLayerInit()
      this.frame = frame || self
      if (Nav) {
            if (Nav4) {
                  if (!frame) {
                        if (!nestref) var nestref = DynLayer.nestRefArray[id]
                        if (!DynLayerTest(id,nestref)) return
                        this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
                  }
                  else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
                  this.elm = this.event = this.css
                  this.doc = this.css.document
            }
            if (Nav5) {
                  this.elm = document.getElementById(id)
                  this.css = this.elm.style
                  this.doc = document
            }
            this.x = this.css.left
            this.y = this.css.top
            this.w = this.css.clip.width
            this.h = this.css.clip.height
      }
      else if (IE) {
            this.elm = this.event = this.frame.document.all[id]
            this.css = this.frame.document.all[id].style
            this.doc = document
            this.x = this.elm.offsetLeft
            this.y = this.elm.offsetTop
            this.w = (IE4)? this.css.pixelWidth : this.elm.offsetWidth
            this.h = (IE4)? this.css.pixelHeight : this.elm.offsetHeight
      }
      this.id = id
      this.nestref = nestref
      this.obj = id + "DynLayer"
      eval(this.obj + "=this")
}
function DynLayerMoveTo(x,y) {
      if (x!=null) {
            this.x = x
            if (Nav) this.css.left = this.x
            else this.css.pixelLeft = this.x
      }
      if (y!=null) {
            this.y = y
            if (Nav) this.css.top = this.y
            else this.css.pixelTop = this.y
      }
}
function DynLayerMoveBy(x,y) {
      this.moveTo(this.x+x,this.y+y)
}
function DynLayerShow() {
      this.css.visibility = (Nav)? "show" : "visible"
}
function DynLayerHide() {
      this.css.visibility = (Nav)? "hide" : "hidden"
}
DynLayer.prototype.moveTo = DynLayerMoveTo
DynLayer.prototype.moveBy = DynLayerMoveBy
DynLayer.prototype.show = DynLayerShow
DynLayer.prototype.hide = DynLayerHide
DynLayerTest = new Function('return true')

// DynLayerInit Function
function DynLayerInit(nestref) {
if (!DynLayer.set) DynLayer.set = true

if (Nav) {
  if (nestref)
  {
    ref = eval('document.'+nestref+'.document');
  }
  else
  {
    nestref = ''; ref = document;
  }
  for (var i=0; i<ref.layers.length; i++) {
    var divname = ref.layers[i].name
    DynLayer.nestRefArray[divname] = nestref
    var index = divname.indexOf("DIV")
    if (index > 0)
      {
      eval(divname.substr(0,index)+' = new DynLayer("'+divname+'","'+nestref+'")')
    }
    if (ref.layers[i].document.layers.length > 0) {
      DynLayer.refArray[DynLayer.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
    }
  }
  if (DynLayer.refArray.i < DynLayer.refArray.length) {
  DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++])
  }
}      
else if (DOM) {
  for (var i=0; i<document.getElementByTagname("DIV").length; i++) {
    var divname = document.getElementByTagname("DIV")[i].id
    var index = divname.indexOf("DIV")
    if (index > 0) {
      eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
    }
  }      
}
else if (IE)
{
  for (var i=0; i<document.all.tags("DIV").length; i++)
  {
    var divname = document.all.tags("DIV")[i].id
    var index = divname.indexOf("DIV")
    if (index > 0)
      {
      eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
    }
  }
}
return true
}
DynLayer.nestRefArray = new Array()
DynLayer.refArray = new Array()
DynLayer.refArray.i = 0
DynLayer.set = false



// Slide Methods
function DynLayerSlideTo(endx,endy,inc,speed,fn) {
      if (endx==null) endx = this.x
      if (endy==null) endy = this.y
      var distx = endx-this.x
      var disty = endy-this.y
      this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideBy(distx,disty,inc,speed,fn) {
      var endx = this.x + distx
      var endy = this.y + disty
      this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function DynLayerSlideStart(endx,endy,distx,disty,inc,speed,fn) {
      if (this.slideActive) return
      if (!inc) inc = 10
      if (!speed) speed = 10
      var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
      if (num==0) return
      var dx = distx/num
      var dy = disty/num
      if (!fn) fn = null
      this.slideActive = true
      this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function DynLayerSlide(dx,dy,endx,endy,num,i,speed,fn) {
      if (!this.slideActive) return
      if (i++ < num) {
            this.moveBy(dx,dy)
            this.onSlide()
            if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
            else this.onSlideEnd()
      }
      else {
            this.slideActive = false
            this.moveTo(endx,endy)
            this.onSlide()
            this.onSlideEnd()
            eval(fn)
      }
}
DynLayerSlideInit = new Function()
DynLayer.prototype.slideInit = new Function()
DynLayer.prototype.slideTo = DynLayerSlideTo
DynLayer.prototype.slideBy = DynLayerSlideBy
DynLayer.prototype.slideStart = DynLayerSlideStart
DynLayer.prototype.slide = DynLayerSlide
DynLayer.prototype.onSlide = new Function()
DynLayer.prototype.onSlideEnd = new Function()

// Clip Methods
function DynLayerClipInit(clipTop,clipRight,clipBottom,clipLeft) {
      if (IE) {
            if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
            else if (IE4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
      }
}
function DynLayerClipTo(t,r,b,l) {
      if (t==null) t = this.clipValues('t')
      if (r==null) r = this.clipValues('r')
      if (b==null) b = this.clipValues('b')
      if (l==null) l = this.clipValues('l')
      if (Nav) {
            this.css.clip.top = t
            this.css.clip.right = r
            this.css.clip.bottom = b
            this.css.clip.left = l
      }
      else if (IE) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function DynLayerClipBy(t,r,b,l) {
      this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function DynLayerClipValues(which) {
      if (IE) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
      if (which=="t") return (Nav)? this.css.clip.top : Number(clipv[0])
      if (which=="r") return (Nav)? this.css.clip.right : Number(clipv[1])
      if (which=="b") return (Nav)? this.css.clip.bottom : Number(clipv[2])
      if (which=="l") return (Nav)? this.css.clip.left : Number(clipv[3])
}
DynLayer.prototype.clipInit = DynLayerClipInit
DynLayer.prototype.clipTo = DynLayerClipTo
DynLayer.prototype.clipBy = DynLayerClipBy
DynLayer.prototype.clipValues = DynLayerClipValues

// Write Method
function DynLayerWrite(html) {
      if (Nav) {
            this.doc.open()
            this.doc.write(html)
            this.doc.close()
      }
      else if (IE) {
            this.event.innerHTML = html
      }
}
DynLayer.prototype.write = DynLayerWrite

// BrowserCheck Object
/*function BrowserCheck() {
      var b = navigator.appName
      if (b=="Netscape") this.b = "ns"
      else if (b=="Microsoft Internet Explorer") this.b = "ie"
      else this.b = b
      this.version = navigator.appVersion
      this.v = parseInt(this.version)
      thNav = (this.b=="ns" && this.v>=4)
      thNav4 = (this.b=="ns" && this.v==4)
      thNav5 = (this.b=="ns" && this.v==5)
      thIE = (this.b=="ie" && this.v>=4)
      thIE4 = (this.version.indexOf('MSIE 4')>0)
      thIE5 = (this.version.indexOf('MSIE 5')>0)
      this.min = (thNav||thIE)
}
is = new BrowserCheck()*/

// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
      if (id=="START") return '<STYLE TYPE="text/css">\n'
      else if (id=="END") return '</STYLE>'
      var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
      if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
      if (arguments.length>=5 && height!=null) {
            str += ' height:'+height+'px;'
            if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
      }
      if (arguments.length>=6 && color!=null) str += (Nav)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
      if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
      if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
      if (arguments.length==9 && other!=null) str += ' '+other
      str += '}\n'
      return str
}
function writeCSS(str,showAlert) {
      str = css('START')+str+css('END')
      document.write(str)
      if (showAlert) alert(str)
}
----------------------------------------------------------
And as for Kasandra,I've tried using your new code but there are errors and I'm still working on it okay ;) Thanks anyway Guys..
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8124546
>>And as for Kasandra,I've tried using your new code but there are errors and I'm still working on it okay ;) <<

Like I said, I haven't tested it because I don't know how you are using it. What are the errors you are receiving?
0
 

Author Comment

by:hernaezia
ID: 8124548
Kasandra,by using your code my menu list has been displayed but still it doesnt function. The error is "is is not defined" :/
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8124610
Ah, I missed a function!

Change this:

function DynLayerClipValues(which) {
 if (isIE)
   var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px");
 if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0]);
 if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1]);
 if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2]);
 if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3]);
}

to:

function DynLayerClipValues(which) {
 if (isIE)
   var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px");
 if (which=="t") return (isIE)? Number(clipv[0]) : this.css.clip.top;
 if (which=="r") return (isIE)?  Number(clipv[1]) : this.css.clip.right;
 if (which=="b") return (isIE)?  Number(clipv[2]) : this.css.clip.bottom;
 if (which=="l") return (isIE)?  Number(clipv[3]) : this.css.clip.left;
}
0
 

Author Comment

by:hernaezia
ID: 8124994
well i think that solves that particular undefined error but my other file list.js seems to have a new error.."Error: this.items[i].lyre.event has no properties
Source File: list.js
Line: 127"

-------------------------------------------------------
// List Object
// generic selection widget built primarily to be incorporated into other List-based widgets (MenuList, ScrollList, SelectList)
// 20020810

// Copyright (C) 2002 ESDC Technology


function List(x,y,width,itemH) {
      this.name = "List"+(List.count++)
      this.x = x
      this.y = y
      this.w = width
      if (arguments.length==4) {
            this.itemH = itemH
            this.itemHset = true
            this.h = -1
      }
      else {
            this.itemH = null
            this.itemHset = false
            this.h = (isNav)? -1 : 1000
      }

      this.itemSpacing = 1
      this.fontname = 'Verdana'
      this.fontsize = 8
      this.visibility = 'inherit'

      this.color = new Object()
      this.color.textNormal = '#000000'
      this.color.textSelected = '#FFFFFF'
      this.color.bgNormal = '#FFCC00'
      this.color.bgSelected = '#FF9900'
      this.color.bgRollover = '#FF9900'
      this.color.bg = '#ffffff'

      this.allowDeselect = false
      this.multiSelect = false
      this.preSelect = true

      this.items = new Array()
      this.selectedIndex = null
      this.obj = this.name + "ListObject"
      eval(this.obj + "=this")

      this.add = ListAdd
      this.build = ListBuild
      this.activate = ListActivate
      this.over = ListOver
      this.out = ListOut
      this.down = ListDown
      this.select = ListSelect
      this.setCols = ListSetCols
      this.image = new Object()
      this.setImage = ListSetImage
      this.deselect = ListDeselect
      this.onSelect = new Function()
}
function ListSetCols() {
      this.cols = arguments
      this.multiCol = true
}
function ListSetImage(image0,image1,width,height) {
      this.image.image0 = new Image()
      this.image.image0.src = image0
      this.image.image1 = new Image()
      this.image.image1.src = image1
      this.image.w = width
      this.image.h = height
}
function ListAdd(value) {
      var i = this.items.length
      this.items[i] = new Array()
      this.items[i].selected = false
      this.items[i].value = value
      if (arguments.length>2) {
            this.items[i].textNormal = this.items[i].textSelected = '<table border=0 cellpadding=0 cellspacing=0><tr>'
            this.items[i].text = new Array()
            for (var j=1;j<arguments.length;j++) {
                  this.items[i].text[j-1] = arguments[j]
                  this.items[i].textNormal += '<td width='+this.cols[j-1]+'><div class="'+this.name+'TextNormal">'+arguments[j]+'</div></td>'
                  this.items[i].textSelected += '<td width='+this.cols[j-1]+'><div class="'+this.name+'TextSelected">'+arguments[j]+'</div></td>'
            }
            this.items[i].textNormal += '</tr></table>'
            this.items[i].textSelected += '</tr></table>'
      }
      else {
            this.items[i].text = arguments[1]
            this.items[i].textNormal = '<div class="'+this.name+'TextNormal">'+arguments[1]+'</div>'
            this.items[i].textSelected = '<div class="'+this.name+'TextSelected">'+arguments[1]+'</div>'
      }
      if (this.itemH) {
            this.h += this.itemH+this.itemSpacing
            this.items[i].y = i*this.itemH+i*this.itemSpacing
      }
      else this.items[i].y = 0
}
function ListBuild() {
      this.css = ''
      this.css += css(this.name+'List',this.x,this.y,this.w,this.h,this.color.bg,(this.itemHset)?this.visibility:'hidden')
      for (var i=0;i<this.items.length;i++) {
            this.css += css(this.name+'ListItem'+i,0,this.items[i].y,this.w,this.itemH,this.color.bgNormal)
            if (this.items[i].hasImage) this.css += css(this.name+'ListItemImgLyr'+i,this.w-this.image.w,this.items[i].y)
            this.css += css(this.name+'ListItemC'+i,0,this.items[i].y,this.w,this.itemH)
      }
      this.css += '.'+this.name+'TextNormal {font-family:"'+this.fontname+'"; font-size:'+this.fontsize+'pt; color:'+this.color.textNormal+'; background-color:transparent;}\n'+
      '.'+this.name+'TextSelected {font-family:"'+this.fontname+'"; font-size:'+this.fontsize+'pt; color:'+this.color.textSelected+'; background-color:transparent;}\n'
      
      this.div = '<div id="'+this.name+'List">\n'
      for (var i=0;i<this.items.length;i++) {
            this.div += '<div id="'+this.name+'ListItem'+i+'">'+this.items[i].textNormal+'</div>\n'
            if (this.items[i].hasImage) this.div += '<div id="'+this.name+'ListItemImgLyr'+i+'"><img name="'+this.name+'ListItemImg'+i+'" src="'+this.image.image0.src+'" width='+this.image.w+' height='+this.image.h+'></div>\n'
            this.div += '<div id="'+this.name+'ListItemC'+i+'"></div>\n'
      }
      this.div += '</div>'
}
function ListActivate() {
      if (isIE) this.h -= 1000
      this.lyr = new DynLayer(this.name+'List')
      this.lyr.clipInit()
      for (var i=0;i<this.items.length;i++) {
            this.items[i].lyr = new DynLayer(this.name+'ListItem'+i)
            this.items[i].lyr.setbg = DynLayerSetbg
            this.items[i].lyre = new DynLayer(this.name+'ListItemC'+i)
            
//line 127 error            if (isNav) this.items[i].lyre.event.captureEvents(Event.MOUSEDOWN)
            this.items[i].lyre.event.onmouseout = new Function(this.obj+'.over('+i+'); return false;')
            this.items[i].lyre.event.onmouseout = new Function(this.obj+'.out('+i+'); return false;')
            
            
            if (isNav) this.items[i].lyre.event.captureEvents(Event.MOUSEOVER)
            this.items[i].lyre.event.onmouseover = new Function(this.obj+'.over('+i+'); return false;')
            this.items[i].lyre.event.onmouseout = new Function(this.obj+'.out('+i+'); return false;')
            this.items[i].lyre.event.onmousedown = new Function(this.obj+'.down('+i+'); return false;')
            

            
            if (!this.itemHset) {
                  this.itemH = (isNav)? this.items[0].lyr.doc.height : this.items[0].lyr.event.offsetHeight
                  this.items[i].lyr.moveTo(null,i*this.itemH+this.itemSpacing*i)
                  this.items[i].lyre.moveTo(null,i*this.itemH+this.itemSpacing*i)
                  if (isNav) {
                        this.items[i].lyr.clipInit()
                        this.items[i].lyr.clipTo(0,this.w,this.itemH,0)
                        this.items[i].lyre.clipInit()
                        this.items[i].lyre.clipTo(0,this.w,this.itemH,0)
                  }
                  this.h += this.itemH+this.itemSpacing
            }
            if (this.items[i].hasImage) {
                  this.items[i].imagelyr = new DynLayer(this.name+'ListItemImgLyr'+i)
            }
      }
      if (!this.itemHset) {
            this.lyr.clipTo(0,this.w,this.h,0)
            if (isIE) this.lyr.css.height = this.h
      }
      if (this.preSelect!=null) this.select(this.preSelect)
      this.lyr.css.visibility = this.visibility
}
function ListOver(i) {
      if (!this.items[i].selected) this.items[i].lyr.setbg(this.color.bgRollover)
}
function ListOut(i) {
      if (!this.items[i].selected) this.items[i].lyr.setbg(this.color.bgNormal)
}
function ListDown(i) {
      if (!this.items[i].selected) {
            if (!this.multiSelect && this.selectedIndex!=null) this.deselect(this.selectedIndex)
            this.select(i)
            this.onSelect()
      }
      else {
            if (this.multiSelect || this.allowDeselect) {
                  this.deselect(i)
                  this.onSelect()
            }
      }
}
function ListSelect(index) {
      if (this.items[index]!=null) {      
            this.selectedIndex = index
            this.value = this.items[index].value
            if (this.items[index].hasImage) this.items[index].imagelyr.doc.images[this.name+'ListItemImg'+index].src = this.image.image1.src
            this.items[index].lyr.setbg(this.color.bgSelected)
            this.items[index].lyr.write(this.items[index].textSelected)
            this.items[index].selected = true
      }
}
function ListDeselect(index) {
      if (this.items[index]!=null) {
            if (this.items[index].selected) {
            if (this.items[index].hasImage) this.items[index].imagelyr.doc.images[this.name+'ListItemImg'+index].src = this.image.image0.src
            this.items[index].lyr.setbg(this.color.bgNormal)
            this.items[index].lyr.write(this.items[index].textNormal)
            this.items[index].selected = false
            }
      }
}
function ListRedirect() {
      location.href = this.value
}
List.count = 0

// Dynlayer setbg() required
function DynLayerSetbg(color) {
      if (isNav) this.doc.bgColor = color
      else if (isIE) this.css.backgroundColor = color
}
-----------------------------------------------------------

Can you plz check it out for me..I have no idea wats d prblem is..
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8125179
This question seems to keep growing exponentially!
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8125210
Incidentally, which browser is giving you that error?
0
 

Author Comment

by:hernaezia
ID: 8125656
The website that I had designed works perfectly well in IE but this complicated errors came out everytime I open the website using any version of Netscape-the javascript problem :/
0
 
LVL 5

Accepted Solution

by:
kasandra earned 330 total points
ID: 8125875
Well, in that list.js you have changed is.ns and is.IE to is Nav and isIE, but haven't added code for isDOM cases..

As far as Netscape 4 is concerned, that error wouldn't have come about as a result of any changes I suggested - it would have been there all along.

It looks like I have fixed the original question you asked - this is an additional one.

It is extremely difficult helping you with these questions because they are very complicated bits of code, without the HTML calling them to be able to test them.

One comment I can make about that particular section:


(line127) if (isNav) this.items[i].lyre.event.captureEvents(Event.MOUSEDOWN)

captureEvents is proprietary to Netscape 4.

I'm not sure if you are supposed to put the .event in there though - I think that is only used in IE?

Assuming you are testing this in Netscape 6 or 7, you should not receive an error message on this line, because it shouldn't execute it... I assume you are using the same browser sniffer as I gave you for dynlayer.js?

You need an if (isDOM) for NN6+, and I _think_ the syntax is the same for IE, minus the .event - that is:

this.items[i].lyre.onmouseout = new Function(this.obj+'.over('+i+'); return false;')

(line128) this.items[i].lyre.event.onmouseout = new Function(this.obj+'.over('+i+'); return false;')
(line129) this.items[i].lyre.event.onmouseout = new Function(this.obj+'.out('+i+'); return false;')
         
Are both these lines supposed to be this.items[i].lyre.event.onmouseout?    
 
   
(line130) if (isNav) this.items[i].lyre.event.captureEvents(Event.MOUSEOVER)

I imagine if line 127 is giving you an error, this one will too.

(line131) this.items[i].lyre.event.onmouseover = new Function(this.obj+'.over('+i+'); return false;')
(line132) this.items[i].lyre.event.onmouseout = new Function(this.obj+'.out('+i+'); return false;')

ANOTHER this.items[i].lyre.event.onmouseout ?

... This is really turning into an enormous question. It should only answer one specific question, and already I have tried helping you with 2 huge chunks of code. If you do have any other lines you need help debugging, you should start a new question.
0
 

Author Comment

by:hernaezia
ID: 8126088
Thanks Kasandra..I think I'll try to solve that problem by myself and when I still stucked with that error then I'll come back with another question.Thanks again for being so generous in giving suggestions. I appreciate it so much.
0
 
LVL 5

Expert Comment

by:gator4life
ID: 8126177
After <b>all</b> that help you gave her a 'B'?  Don't be surprised if she doesn't help you next time...

gator4life
(chomp, chomp)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8126199
Yes, I must admit I have to echo gator's comment - I am disappointed after all that help, and I did solve your original problem, that you only gave me a B :(
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8127170
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20549033.html

hernaezia,

Do we have 2 accounts.  Seems like the same question.

Computer101
E-E Admin
0
 

Author Comment

by:hernaezia
ID: 8133175
Well,dont be sad Kasandra coz i gave you all the points that i had and i have n points left for me as I didnt buy any points from EE (too young+early to have a credit card).I'm giving you a B coz I think you've helped me get through my original problem (which is problem only in Netcape)but now it seems that my menu list cannot function in both IE and Netscape.B is for 'good', right? And you were really good but still I need something that could really solve my problem and now I'm back using the old code as it works in IE.I have to search and think another way to settle my Netcape problem. So Kasandra, you are older than me and a lot more experienced in this web programming thing and I really really appreciated you being so helpful to me but I dont know what to say if you think that the grade and more points are more important to you ;) anyway Sorry for the B and for Gator4life 'ko cam cibaila batu api tul' ;)  
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8133272
hernaezia - I gave you a lot of help when the points started out very low, I was just trying to make you more aware of how things work around here. I am grateful that you did increase the points as suggested.

Us "experts" are volunteers - we don't get paid to do this, and it does take time to help people.. So while the grades and points aren't everything, they are the main incentive for experts to keep coming back and spending a lot of their free time helping other people.

This particular question took a fair amount of my time to try to help you. I know I couldn't completely solve your problems, because making it cross browser is actually a HUGE undertaking, particularly when more than one javascript file was involved, with both of them being long, complex ones at that.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now-a-days, indirectly, postal services have been replaced by email services. Yes, whenever we hear the word "email" a lot of people only think of gmail. Some people still think that email and gmail are one and the same thing :-). Let's see some …
Several part series to implement Internet Explorer 11 Enterprise Mode
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question