Newbie problem: problem running the 'Hello World' script

156 views
Skip to first unread message

NewUser

unread,
Aug 23, 2017, 2:25:52 PM8/23/17
to jsPsych
Hello, 

Following the tutorial, I pasted the following code directly from the site into a TextMate file, saved, and attempted to open it in Chrome (also tried Firefox/Safari). However, the screen is blank, instead of displaying 'Hello World'. (The experiment file and the jspsych-5.0.3 file are in the same folder.) Would appreciate your guidance on why this is happening! Thanks.

<!doctype html>
<html>
    <head>
        <title>My experiment</title>
<script src="jspsych-5.0/jspsych.js"></script>
<script src="jspsych-5.0/plugins/jspsych-text.js"></script>
<link href="jspsych-5.0/css/jspsych.css" rel="stylesheet" type="text/css"></link>
    </head>
    <body>
    </body>
<script>
var hello_trial = { 
type: 'text'
text: 'Hello world!'
}
jsPsych.init)({
timeline: [hello_trial]
})
</script>
</html>


PS:
To rule out further issues, I ran this basic script successfully: 
<!doctype html>
<html>
    <head>
        <title>My experiment</title>
<script src="jspsych-5.0/jspsych.js"></script>
<script src="jspsych-5.0/plugins/jspsych-text.js"></script>
<link href="jspsych-5.0/css/jspsych.css" rel="stylesheet" type="text/css"></link>
    </head>
    <body>
<h1> My First Heading!</h1>
<p>My first paragraph!!</p>
    </body>
</html>

ra.ht...@gmail.com

unread,
Aug 24, 2017, 4:47:10 AM8/24/17
to jsPsych
Since, you downloaded the jspsych-5.0.3 version, it might be that you need to change the script src to jspsych-5.0.3 , like below for each of the jspsych scripts.

<script src="jspsych-5.0.3/jspsych.js"></script>

Best,
Jamie

Reply all
Reply to author
Forward
0 new messages