SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    reading z-Index or zIndex

    I use this function to swap layers.....

    function bring4wrd(move){
    presentz=(document.getElementById(move).style.zIndex)
    alert(presentz)
    if(move=="drumctrl") {if(presentz==0) presentz=-3}
    if(presentz==0) presentz=-1
    newz=0-presentz
    document.getElementById(move).style.zIndex=newz}

    The trouble is the first time it is triggered the z-index of 'move' is 0, although the second time it goes through it reads the zIndex correctly

    is it because of the difference of z-Index in css and zIndex in javascript?

    Many thanks
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's because in IE 5+ you need to read from the currentStyle object, and not just style. I'll let you determine how you'd like to sniff-out IE.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

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