Hello-
I have to develop a script that will randomly rotate selections on a form (radio buttons), I have been able to accomplish this but I have just realized that I am not passing the value for each selection. I have pasted the script below, any help greatly appreciated:
<html>
<head>
<script>
var arrayOfData1 = [“Buying”,”Refinancing”,”Other”];
var arrayOfData2 = [“Rates are too high”,
“I don’t trust that my personal online”,
“I didn’t want to be charged an application fee “,
“I never enter my credit card information online”,
“I had too many questions about the application process “];
var arrayOfData3 = [“Accessed the Glossary sectionof the web site”,
“Called the 800# “,
“Left the web site “];
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.floor(rnd()*number);
};
function writeRadioButton(name, array) {
while (array.length > 0) {
var randOption = rand(array.length);
document.write(‘<INPUT TYPE=”RADIO” NAME=”‘ + name + ‘” > ‘ +
array[randOption] + ‘<BR>’);
array[randOption] = array[array.length – 1]
–array.length;
}
}
</script>
</head>
<body>
<form method=”post” action=”
onsubmit=”return checkRequired(this)”>
<INPUT type=”hidden” NAME=”form_version” VALUE=”1″/>
<INPUT type=”hidden” NAME=”source_site” VALUE=”AD Feedback Response”/>
<INPUT type=”hidden” NAME=”thankyou”
VALUE=”
<INPUT type=”hidden” NAME=”thankyou_page” VALUE=””/>
<INPUT type=”hidden” NAME=”fieldorder”
VALUE=”Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15,Q16,Q17,Q18″/
>
<p><b>Please tell us your interest in visiting our website:</b><br>
<script>
writeRadioButton(“Q01”, arrayOfData1)
</script>
<p><b>If you did not complete & submit our online application, what was the top
reason that prevented you from doing so?</b><br>
<script>
writeRadioButton(“Q02”, arrayOfData2)
</script>
<p><b>If you had a question while on our web site, what action did you take to
help get an answer to your question?</b><br>
<script>
writeRadioButton(“Q03”, arrayOfData3)
</script>
</form>
</body>
</html>