need explaination on this code?

Discussion in 'JavaScript' started by kumiko, Feb 11, 2008.

  1. #1
    halo..need some help on this code .
    i m not understand wat is this code mean? can some one plz help? thanx
    obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
    
    Code (markup):

     
    kumiko, Feb 11, 2008 IP
  2. locdev

    locdev Active Member

    Messages:
    171
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    it is the same as:

    if(obj.style.visibility == 'visible'){
    obj.style.visibility ='hidden';
    }else{
    obj.style.visibility ='visible';
    }

    ...makes an element visible when it is hidden and vice versa
     
    locdev, Feb 11, 2008 IP
  3. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0