Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    what have i done wrong?

    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

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i really must buy a new book... bought this one about a yearish ago and never got round to reading it...

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    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>

    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •