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

45 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-html.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<script>
/*
this demo will only work if run online or with special permissions enable offline
for chrome, launch the browser from the command-line:
chrome --allow-file-access-from-files
*/
var check_consent = function(elem) {
if (document.getElementById('consent_checkbox').checked) {
return true;
} else {
alert("If you wish to participate, you must check the box next to the statement 'I agree to participate in this study.'");
return false;
}
return false;
};
var consent_block = {
"type": "html",
"force_refresh": true,
"url": "external_html/simple_consent.html",
"cont_btn": "start",
"check_fn": check_consent
}
jsPsych.init({
timeline: [consent_block],
on_finish: function() {
jsPsych.data.displayData();
}
});
</script>
</html>