[thelist] JS: compound ternary
jsWalter
jsWalter at torres.ws
Fri Jan 30 22:13:22 CST 2004
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Tom Dell'Aringa
> Sent: Friday, January 30, 2004 3:29 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] JS: compound ternary
>
>
> Hey JS people,
>
> I'm trying to build a compound ternary statement and I keep falling
> flat on my face. I know I have something mixed up, I keep getting a
> syntax error. There's a bracket set missing or something. Here's the
> statement:
>
> var restrict = (document.getElementById) ?
> document.getElementById(oName) : (document.all) ? document.all[oName]
> : return;
Well, my simple test on this...
var y = 2;
var z = 7;
var x = (y == 1) ? 'y' : (z == 1) ? 'z-1' : 'z-2';
document.write ( x );
produced what I thought it would.
Try displaying values on this before trying to RETURN.
Walter
More information about the thelist
mailing list