Thread: Jscript for risk calculator View Single Post
 05-18-2013, 03:20 PM PM User | #1 tim_k New Coder   Join Date: May 2013 Posts: 10 Thanks: 0 Thanked 0 Times in 0 Posts Jscript for risk calculator Hi all, I'm trying my hand at jscript for the first time (au fait with html and css). I'd like to build a medical risk calculator to sit in a side block on a drupal site. The html form is done. Input x is the size of an aneurysm and input will be in text and then parsed into ranges (0-7mm, 7-10mm and 10+mm) Input y is location of aneurysm and consists of three options, a, b & c. Input z is yes / no radio button Output (risk) should update each time input is changed (no submit button). Each combination of these variables should produce two linked risk values (% in one year and % in five years). The number of potential outputs is thus 3x3x2 = 18 (so it's not really a calculation, more a lookup). I am imagining some sort of 18-faceted list of functions like this: If x=1 AND y=1 AND z=1 THEN output Risk combo 1 IF x=2 AND y=1 AND z=1 THEN output Risk combo 2 IF x=3 AND y=1 AND z=1 THEN output Risk combo 3 IF x=1 AND y=2 AND z=1 THEN output Risk combo 4 IF x=2 AND y=2 AND z=1 THEN output Risk combo 5 IF x=3 AND y=2 AND z=1 THEN output Risk combo 6 IF x=1 AND y=3 AND z=1 THEN output Risk combo 7 IF x=2 AND y=3 AND z=1 THEN output Risk combo 8 IF x=3 AND y=3 AND z=1 THEN output Risk combo 9 If x=1 AND y=1 AND z=2 THEN output Risk combo 10 IF x=2 AND y=1 AND z=2 THEN output Risk combo 11 IF x=3 AND y=1 AND z=2 THEN output Risk combo 12 IF x=1 AND y=2 AND z=2 THEN output Risk combo 13 IF x=2 AND y=2 AND z=2 THEN output Risk combo 14 IF x=3 AND y=2 AND z=2 THEN output Risk combo 15 IF x=1 AND y=3 AND z=2 THEN output Risk combo 16 IF x=2 AND y=3 AND z=2 THEN output Risk combo 17 IF x=3 AND y=3 AND z=2 THEN output Risk combo 18 How should one best go about performing these functions?