Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

There's got to be a simple line of code to do this

$
0
0

I'm trying to change the color of a radio button after a click event on a button that grades a test...below is a sample of my code for the first two questions

Radio button info; Name Q1, Q2, Q3 ----- Q58 (5 possible answers for each Q"") Radio Choice (of the 5) a, b, c, d, e

 

var Answer = this.getField("Q1").value;  

var Grade1; 

 

if (Answer == "a")    NOW IF THE ANSWER IS NOT  "a" THEN THE RADIO BUTTON FOR THE CORRECT ANSWER TURNS GREEN "in that group of answers for Q1" when "Score Test" button is clicked

{var Grade1 = 1} 

else

{var Grade1 = 0}

I would place the code here such as (If(Answer =="b", "c", "d", "e") then (this radio button turns green) BUT I don't know how to identify the individual radio buttons in group Q1 in order to tell which button to turn green....

 

var Answer = this.getField("Q2").value;  

var Grade2; 

 

if (Answer == "e")

{var Grade2 = 2} 

else

{var Grade2 = 0}

 

{var Grade2 = Grade1 + Grade2}

 

 

 

this.getField("SumCorrect").value = Grade2;     ***Grade2 would actually be Grade58 which is the last question.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>