Help getting Loop to display properly
-
Hi there,
I have been working away at my understanding of Javascript, tried to give this forum a break, and came up with the following code. I am trying to display a list of required fields in a calculated field if they aren’t chosen by one of my 6 dropdown fields. I think I’m on the right track but nothing is displaying. Could I please have a hand?
(function(){ var courses = [fieldname70,fieldname308,fieldname312,fieldname316,fieldname320,fieldname324], required = ['ENG4U','PSY4U','MAT4U','SCH4U'], msg = [], ret = 0, i; for(var i=0; i<courses.length; i++){ ret |= 1 << sel[i].selectedIndex >> 1; } for(var i=0; i<required.length; i++){ if(!(1<<i & ret)){ msg.push(required[i]); } } if(msg.length == 0){ msg = 'Everything achieved'; } else if(msg.length == 1){ msg = msg[0] + ' is missing'; } else { msg = msg.slice(0, -1).join(', ') +' and '+ msg.pop() +' are missing'; } return msg; jQuery('#wes_civ').html(msg); })()
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Help getting Loop to display properly’ is closed to new replies.