Hi,
here the script of the main question:
Code:
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tbody>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;" width="0%"> </td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">A</span></span></strong></td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">B</span></span></strong></td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">C</span></span></strong></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Infrastructure Type</span></span></strong></td>
<td style="text-align: center;" width="1%"> </td>
<td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage1}.jpg" /></td>
<td style="text-align: center;" width="1%"> </td>
<td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage2}.jpg" /></td>
<td style="text-align: center;" width="1%"> </td>
<td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage3}.jpg" /></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Travel Time</span></span></strong></td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomTime1==1,'15 min',if(randomTime1==2,'20 min', if(randomTime1==3,'25 min', if(randomTime1==4,'30 min','35 min'))))}</td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomTime2==1,'15 min',if(randomTime2==2,'20 min', if(randomTime2==3,'25 min', if(randomTime2==4,'30 min','35 min'))))}</td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomTime3==1,'15 min',if(randomTime3==2,'20 min', if(randomTime3==3,'25 min', if(randomTime3==4,'30 min','35 min'))))}</td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Speed Limit</span></span></strong></td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomSpeed1==1,'20 mph',if(randomSpeed1==2,'25 mph', if(randomSpeed1==3,'35 mph','40 mph')))}</td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomSpeed2==1,'20 mph',if(randomSpeed2==2,'25 mph', if(randomSpeed2==3,'35 mph','40 mph')))}</td>
<td style="text-align: center;" width="1%"> </td>
<td style="text-align: center;">{if (randomSpeed3==1,'20 mph',if(randomSpeed3==2,'25 mph', if(randomSpeed3==3,'35 mph','40 mph')))}</td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="font-size:18px;"><span style="color:#000000;">Your Choice</span></span></strong></td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"> </td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"> </td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"> </td>
</tr>
</tbody>
</table>
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Move the radios
$('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion));
$('.question-text table:eq(0) tr:last td:eq(4)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion));
$('.question-text table:eq(0) tr:last td:eq(6)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(2) *', thisQuestion));
// Some classes for presentation
$('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio');
$('.question-text table:eq(0) .radio-item label', thisQuestion).show();
// Click event on the table cells
$('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) {
$('input:radio', this).trigger('click');
});
$('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) {
e.stopPropagation();
});
// Clean-up styles
$('.answer-container', thisQuestion).hide();
$('.question-text table:eq(0) .label-text', thisQuestion).remove();
$('.question-text table:eq(0) .radio-text', thisQuestion).css({
'cursor': 'pointer'
});
});
</script>
As I said, a random number 1-10: with this assignment:
1: 1,2,3
2: 1,2,4
3: 1,2,5
4: 1,3,4
5: 1,3,5
6: 1,4,5
7: 3,4,5
8: 2,3,4
9: 2,3,5
10: 2,4,5
At the start there are 10 questions of type equation:
random1: {if(is_empty(random1),rand(1,10),random1)}
randomSpeed1: {if(is_empty(randomSpeed1),rand(1,4),randomSpeed1)}
randomSpeed2: {if(is_empty(randomSpeed2),rand(1,4),randomSpeed2)}
randomSpeed3: {if(is_empty(randomSpeed3),rand(1,4),randomSpeed3)}
randomTime1: {if(is_empty(randomTime1),rand(1,5),randomTime1)}
randomTime2: {if(is_empty(randomTime2),rand(1,5),randomTime2)}
randomTime3: {if(is_empty(randomTime3),rand(1,5),randomTime3)}
rImage1: {if(random1<7,"1",if(random1>7,"2","3"))}
rImage2: {if(random1<4,"2",if(random1<6,"3",if(random1<8,"4",if(random1<10,"3","4"))))}
rImage3: {if(random1==1,"3",if(random1==2,"4",if(random1=

,"5",if(random1==4 or random1==8,"4","5"))))}
Then the main question.
Joffm
I attach the survey again. Now the equations are hidden; but there is an info page that shows the random numbers.
Attachment not found