help me understand a variable setting

Posted by meo on Stack Overflow See other posts from Stack Overflow or by meo
Published on 2010-06-03T16:59:50Z Indexed on 2010/06/03 17:04 UTC
Read the original article Hit count: 192

Filed under:
var fmt = document.documentElement.clientWidth;
        var cls = (fmt<=240)?'pda_ver':(fmt>240&&fmt<=320)?'pda_hor':(fmt>320&&fmt<=640)?'screen_ultralow':(fmt>640&&fmt<=800)?'screen_low':(fmt>800&&fmt<=1024)?'screen_med':(fmt>1024&&fmt<=1280)?'screen_high':'screen_wide';

can someone tell me what this does (just the part where the variable is set with a value i do not understand... what are th ?, : have for a role here)? i have never seen a variable declared like that. Is this a conditional variable setting? if yes how does it work ?

working example

© Stack Overflow or respective owner

Related posts about JavaScript