the problem with layers

by "Samuel Bragg" <goomoo(at)hotmail.com>

 Date:  Thu, 20 Apr 2000 13:58:04 PDT
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original
i have a dhtml scrolling script (jscript) that is being built in vbscript. 
it works fine in IE 4, but in IE5, the layer that contains the icons does 
not show. in netscape, everything is shown, but not positioned properly, 
it's not layering, instead it's all one after the other running down the 
left side. does anyone see any blatent problems in my code? it's currently 
done with span's, but i did try with div's and making an external style 
sheet to assign the properties of the div's.

<script type="text/javascript" language="JavaScript">

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()

var speed=50
var loop, timer

function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function moveIt(x,y){
	this.x=x;this.y=y
	this.css.left=this.x
	this.css.top=this.y
}

function goDown(move){
	if(this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}

function goUp(move){
	if(this.y<0){
		this.moveIt(0,this.y-move)
		if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function scroll(speed){
	if(loaded){
		loop=true;
		if(speed>0) oScroll.down(speed)
		else oScroll.up(speed)
	}
}

function noScroll(){
	loop=false
	if(timer) clearTimeout(timer)
}

var loaded;
function scrollInit(){
	oCont=new makeObj('divCont')
	oScroll=new makeObj('divText','divCont')
	oScroll.moveIt(0,0)
	loaded=true;
}

onload=scrollInit;
</script>


	function BuildNavBar() {
		str = "<span id=divCont style='position:absolute; top:50; left:0; 
overflow:hidden; width:100; visibility: visible; z-index:120;'><span 
id=divText style='position:absolute; z-index:110; visibility: 
visible;'><table width=100><tr><td align=center>"
		for (i=0; i<navArray.length; i++) {
			str += "<A CLASS='NavBarLink' HREF='<%= strRoot %>/modules/" + 
navArray[i][0] + "/" + navArray[i][1] + ".asp" + navArray[i][3] + "' "
			str += (IE4) ? "ONMOUSEOVER='NavRollover(" + i + ",1)' 
ONMOUSEOUT='NavRollover(" + i + ",0)'>" : ">"
			str += "<IMG ID='navicon" + i + "' SRC='<%= strRoot %>/themes/icons/" + 
navArray[i][0] + ".gif' "
			str += (IE4) ? "CLASS='NavBarIcon'>" : "BORDER=0>"
			str += "<BR>" + navArray[i][2] + "</A><P>"
		}
		str += "</td></tr></table></span></span><span id=divMask1 
style='position:absolute; z-index:130; top:0; left:0; visibility: 
visible;'><table width=100 border=0 cellspacing=0 cellpadding=0 
height='10%'><tr><td align=center bgcolor='#808080' valign=middle 
height=50><a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'><img 
src='<%= strRoot %>/themes/icons/moreup.gif' border=0 alt=''><br><font 
color='#FFFFFF'>more</font></a></td></tr></table></span><table 
height='92%'><tr><td>&nbsp;</td></tr></table><span id=divMask2 
style='position:absolute; z-index:140; visibility: visible;'><table 
width=100 border=0 cellspacing=0 cellpadding=0><tr><td align=center 
bgcolor='#808080' valign=top height=50><a href='#' onmouseover='scroll(10)' 
onmouseout='noScroll()'><font color='#FFFFFF'>more</font><br><img src='<%= 
strRoot %>/themes/icons/moredown.gif' vspace=2 border=0 
alt=''></a></td></tr></TABLE></span>"
		return str;
	}
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA