0

我在 jsPsych 中编写了一个简单的脚本,欢迎用户访问页面,然后在他们按下任意键后感谢他们的参与。但是,它不会加载与页面关联的 CSS 样式。样式表位于适当的位置,并且没有生成错误或警告。

整个代码如下:

<!DOCTYPE html>
><html lang="en">
  <head>
    <meta charset="UTF-8">

    <script type="text/javascript" src="jsPsych/jspsych.js"></script>
    <script type="text/javascript" src="jsPsych/plugins/jspsych-html-keyboard-response.js"></script>
    <script type="text/javascript" src="jsPsych/plugins/jspsych-image-keyboard-response.js"></script>
    <script type="text/javascript" src="jsPsych/plugins/jspsych-survey-text.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <link href="jsPsych/css/jspsych.css" rel="stylesheet" type="text/css"/>

  </head>
  <body>
  </body>

  <script>

    var timeline = []

    var welcome = {type: "html-keyboard-response",
           stimulus: "Welcome to the experiment, and thank you for your time! Press any key to continue."
          };
    timeline.push(welcome)
    
    jsPsych.init({
    timeline: timeline,
    on_finish: function() {
        $.ajax({
        type: "POST",
        url: "/experiment-data",
        data: jsPsych.data.get().json(),
        contentType: "application/json"
        })
        .done(function() {
            alert("Thank you!")
            window.location.href = "/";
        })
        .fail(function() {
            alert("A problem occurred while writing to the database. Please contact the researcher for more information.")
            window.location.href = "/";
        })
    }
    })

    </script>
</html>

4

0 回答 0