jsPsych/examples/jspsych-survey-multi-choice.html
2017-07-23 13:04:39 -04:00

38 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-survey-multi-choice.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<body></body>
<script>
// defining groups of questions that will go together.
var page_1_questions = ["I like vegetables.", "I like fruit."];
// definiting two different response scales that can be used.
var page_1_options = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"];
var page_2_options = ["Strongly Disagree", "Disagree", "Somewhat Disagree", "Neural", "Somewhat Agree", "Agree", "Strongly Agree"];
var multi_choice_block = {
type: 'survey-multi-choice',
nested: [{question: "I like vegetables", options: page_1_options, required:true,}, {question: "I like fruit", options: page_2_options, required: false}],
};
var multi_choice_block_horizontal = {
type: 'survey-multi-choice',
nested: [{question: "I like vegetables", options: page_1_options, required: true, horizontal: true,}, {question: "I like fruit", options: page_2_options, required: false, horizontal: false}],
};
jsPsych.init({
timeline: [multi_choice_block, multi_choice_block_horizontal],
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</html>