...

View Full Version : what have i done wrong?



sabian
03-11-2005, 02: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)

Kor
03-11-2005, 04:41 PM
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, 04:53 PM
i really must buy a new book... bought this one about a yearish ago and never got round to reading it...

Mr J
03-11-2005, 11:48 PM
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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum