View Full Version : what have i done wrong?
sabian
03-11-2005, 01:02 PM
Quite simply, im playing with layer... what have i done wrong? it really doesnt work for some wierd reason and i cant see what ive done... any ideas?
index.htm (http://www.voisd.com/upload/index2.htm)
It is not weird at all. You are using a deprecate piece of code which uses document.layers as elements' reference (tyipically for the old NS4). At the momemnt no other browser uses that kinda reference.
sabian
03-11-2005, 03:53 PM
i really must buy a new book... bought this one about a yearish ago and never got round to reading it...
Try this
<HTML>
<HEAD>
<TITLE>Slide Show</TITLE>
<script type=text/javascript>
<!--
function init(){
el=document.getElementsByTagName("DIV")
}
function hideAll(){
for(var i=0;i<el.length;i++)
el[i].style.visibility="hidden"
}
function getCurrent(){
for(var i=0;i<el.length;++i)
if(el[i].style.visibility!="hidden") return i
return 0
}
function makeVisible(i){
el[i].style.visibility="inherit"
}
function lastSlide(){
return el.length-1
}
function first(){
hideAll()
makeVisible(0)
}
function prev(){
var i=getCurrent()
hideAll()
if(i>0) makeVisible(i-1)
else makeVisible(i)
}
function next(){
var i=getCurrent()
hideAll()
if(i<lastSlide()) makeVisible(i+1)
else makeVisible(i)
}
function last(){
hideAll()
makeVisible(lastSlide())
}
//-->
</script>
<STYLE type=text/javascript>
tags.UL.fontSize="18pt"
tags.UL.lineHeight=2
</STYLE>
</HEAD>
<BODY bgColor=white onload="init()">
<FORM>
<INPUT onclick=first() type=button value="First Slide">
<INPUT onclick=prev() type=button value="Previous Slide">
<INPUT onclick=next() type=button value="Next Slide">
<INPUT onclick=last() type=button value="Last Slide">
</FORM>
<DIV style="visibility:visible" bgcolor="white" name="slide0"><H1>DIVs and Divisions</H1></DIV>
<DIV style="visibility:hidden" bgcolor="white" name="slide1"><H1>Different Tags</H1></DIV>
<DIV style="visibility:hidden" bgcolor="white" name="slide2"><H1>Third and Final DIV</H1></DIV>
</BODY>
</HTML>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.