jsPsych/examples/jspsych-survey-multi-choice.html
2016-12-09 21:25:56 -05:00

45 lines
1.5 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>
<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',
questions: page_1_questions,
options: [page_1_options, page_2_options], // need one scale for every question on a page
required: [true, false] // set whether questions are required
// horizontal: true // centres questions and makes options display horizontally
};
var multi_choice_block_horizontal = {
type: 'survey-multi-choice',
questions: page_1_questions,
options: [page_1_options, page_2_options], // need one scale for every question on a page
required: [true, false], // set whether questions are required
horizontal: true // centres questions and makes options display horizontally
};
jsPsych.init({
timeline: [multi_choice_block, multi_choice_block_horizontal],
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</html>