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 2 of 2
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing CSS z-index

    Page in question: http://www.therabbitshome.com/


    I thought this would work but it doesn't:

    Code:
    var t_3_l_1=document.getElementById("trhbg_t3_l1");
    var t_3_l_1_zindex=t_3_l_1.style.z-index;
    t_3_l_1_zindex=t_3_l_1_zindex-4;
    I get an "index is not defined" error. Pls help thx.

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    725
    Thanks
    35
    Thanked 132 Times in 123 Posts
    don't use the hyphen when reading or writing a style property of an element,

    change element.style.z-index to element.style.zIndex.

    (Remember to set the property as element.style.zIndex)
    Last edited by mrhoo; 06-11-2012 at 07:47 PM.


  •  

    Posting Permissions

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