mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
58 lines
2.0 KiB
HTML
58 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css">
|
|
<script defer src="https://code.getmdl.io/1.2.1/material.min.js"></script>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-form.js"></script>
|
|
<script src="../plugins/jspsych-text.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css"></script>
|
|
|
|
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>-->
|
|
|
|
<head>
|
|
<title></title>
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
<script type="text/javascript">
|
|
|
|
function clickToSubmit() {
|
|
alert("This is a test. Check Question #7 to see the effect.");
|
|
document.getElementById("custom_id_1").value += "Customize actions when submit buttons is pressed.";
|
|
return {"Customized output": "Customize actions when submit buttons is pressed."};
|
|
}
|
|
|
|
var schema = {
|
|
form: {form_title: 'Test #1'}, // , ribbon_bg: "img/ribbon.jpg", layout_color: "grey-300", content_bg_color: "grey-100"},
|
|
"Question #1": {type: "short answer", correct: "Answer #1", required: true},
|
|
"Question #2": {type: "password"},
|
|
"Question #3": {type: "checkbox", labels: ["option1", "option2"], correctAnswers: ["value1", "value2"], values:["value1", "value2"]},
|
|
"Question #4": {type: "radio", labels: ["option1", "option2"], correctAnswers: ["option1"]},
|
|
"Question #5": {type: "range"},
|
|
"Question #6": {type: "dropdown"},
|
|
"Question #7": {type: "long answer", question_description: "Some random contents", id: "custom_id_1"},
|
|
"Question #8<p>Some random contents</p>": {type: "long answer", question_description: ""},
|
|
onSubmit: {label: "Submit", onclick: clickToSubmit}
|
|
}
|
|
|
|
var text_trial = {
|
|
type: 'text',
|
|
text: 'Press any key to view form.'
|
|
}
|
|
|
|
var form_trial = {
|
|
type: 'form',
|
|
schema: schema
|
|
}
|
|
|
|
jsPsych.init({
|
|
timeline: [text_trial, form_trial],
|
|
on_finish: function(){ jsPsych.data.displayData(); }
|
|
});
|
|
|
|
</script>
|
|
|
|
</html>
|