HOW TO MAKE A PSYCH EXPERIMENT WORK ONLINE:

Jeanine Skorinko

1)How to build a webpage 101

a)Open a typing program on your computer

  1. For macs, Simpletext or Textedit for OS X
  2. For pcs, use WordPad or Notepad
  3. Occassionally, these programs will tell you that they don’t have any more memory for more code, so I use Word, but I HATE it. You have to be very careful to save it as a textfile and not a word doc or a word html file (it puts all this nonsense in the code and it is impossible to find what you want to change).

b)The first thing you need to know is that you always “open” and “close” a command. If you want to start a paragraph you’d put <p>, at the end of the paragraph you have to close it, /p>. It looks like this:

<p> I started my paragraph. I’m writing text that will be seen. Now I am finished. So, I close the paragraph. </p>

c)To begin a html document you start the page with:

<html>

d)Next comes the head section, this is where you will put the page title and if you use any javascript codes 99% of the time they go in this section. So far the webpage looks like this:

html

<head>

<title>Class Project</title>

</head>

e)Next you would add the FORM command so the data knows where to go:

html

head

title>Class Project</title

/head

<form action=" method="post">

f)NOTICE: The <form> is not closed. You won’t close it until the end.

g)Now the fun begins. You start the BODY section which is where all the cool stuff comes into play. You start a body section with <body>. You can change the color of the background and the text color and font too.

html

head

title>Class Project</title

/head

form action=" method="post">

<body bgcolor="99ccff" text="#000000">

h)bgcolor = the background color. To change it you need to find the web-safe colors this can be found online. Text = the color of the text, again web-safe colors and the codes can be found online.

i)The important codes to know:

Paragraph = <p> </p>

Center = <center> </center>

Bold = <b> </b>

Italics = <i> </i>

Underline = <u> </u>

Line Breaks = <br> (you don’t have to close this one)

2)The experiment tools:

  1. Note: Things you will want to change are in orange.
  1. Inserting a Picture:
  2. img src="wm2p.jpg">
  3. wm2p.jpg This is the name of your picture file. You must upload it separately onto your website.
  4. On a mac, you can use the program Fetch
  5. On a pc, you can use FT
  6. For an example see:
  7. Inserting a Video/Audio Clip:
  8. To embed it within the same webpage (this may cause some problems with your webpage’s “look”) but it works nicely:

embed src="bball.mov"

pluginspage="

width=192 height=168

loop="false" controller="true" autoplay="true"

alt="bball.mov. You need quicktime plug in for this to work">

/embed

  1. embed src="bball.mov" This is the name of your movie file. You must upload it separately onto your website.
  2. pluginspage=" This is a link to get the plugin for a quicktime video if they do not have it. You can delete this if you aren’t using .mov (quicktime) or if you don’t want it there.
  3. Note: The different movie files are: .mov, .avi., .wav.
  4. Macs and Pcs can play both, but quicktime is sometimes the easiest…
  5. Again, your movie file name: alt="bball.mov.
  6. This will tell the participant that they need the plugin for the movie to work: You need quicktime plug in for this to work">
  7. For an example see:

iii. Disabling the Back Button

  1. This code prevents the person from accessing the previously view page (e.g. the back button won’t work)
  2. NOTE: This code does not always work, but it is the best one out there—I promise I looked long and hard!
  3. The code can be placed either in the <head> </head> section or just underneath it (before the <form> and <body>):

script language="JavaScript">

!--

javascript:window.history.forward(1);

//--

/script

iv) Must Answer This Question

  1. This code prevents the person from submitting the form without answering a question.
  2. It is long and tedious and usually not worth the effort
  3. This one works with the Free Response Boxes:

html

head

title>Extra Credit Questionnaire</title

script language="JavaScript">

function print_missinginfo() {

missinginfo ="______\n" +

"The Following Fields are Required:\n" +

missinginfo + "\n______" +

"\n";

alert(missinginfo);

document.janetta.mombdaycode.focus();

}

function checkForm() {

missinginfo = "";

if (document.janetta.mombdaycode.value == "") {

missinginfo += "\n - Mother's Maiden Name and Your Birthday";

}

if (missinginfo != "") {

print_missinginfo();

return false;

}

else return true;

}

/script/head

body bgcolor="#99ccff" text="#000000">

form name=janetta action=" method="post" onSubmit="return checkForm();">

  1. document.janetta.mombdaycode.focus();
  2. This tells the webpage to take the participant to this question if they did not fill something in
  3. As far as I know you can only focus on one question, even if you have several you want to make sure are fill out…this only means the participant needs to find the other questions
  4. This is the form’s name: janetta This you set in the <form> area
  5. You change it here:form name=janetta
  6. This is the question’s name: mombdaycode
  7. You decide which free response question you want and put the NAME you gave it up here
  8. This is so it knows which question must be answered in order to submit the form.

c. This is the question you are asking and it is shown to the Participant so they know which question you are talking about (you could add a question #): missinginfo += "\n - Mother's Maiden Name and Your Birthday";

  1. For an example see:
  2. Try clicking the submit button 
  1. This one works with the Buttons (7 point likert):

html

head

title>Civil Trials</title

script language="JavaScript">

function print_missinginfo() {

missinginfo ="______\n" +

"The Following Fields are Required:\n" +

missinginfo + "\n______" +

"\n";

alert(missinginfo);

document.civil1.disagree.focus();

}

function checkForm() {

}

if (disagreechecked != true) {

missinginfo += "\n - Mary Stuart Disagreeable";

}

if (missinginfo != "") {

print_missinginfo();

return false;

}

else return true;

}

/script/head

body bgcolor="#99ccff" text="#000000">

form name=civil1 action=" method="post" onSubmit="return checkForm();">

  1. document.civil1.disagree.focus();
  2. This tells the webpage to take the participant to this question if they did not fill something in
  3. As far as I know you can only focus on one question, even if you have several you want to make sure are fill out…this only means the participant needs to find the other questions
  4. This is the form’s name: civil1 This you set in the <form> area
  5. You change it here:form name=civil1
  6. This is the question’s name: disagree
  7. You decide which free response question you want and put the NAME you gave it up here
  8. This is so it knows which question must be answered in order to submit the form.

c. This is the question you are asking and it is shown to the Participant so they know which question you are talking about (you could add a question #): missinginfo += "\n - How Disagreeable is Mary Stuart?

  1. For an example see:

Try clicking the submit button 

3)The survey tools:

  1. 7 point scales (or 5 or 9 or however many you want)
  2. This is for an buttons to be clicked
  3. Things you will want to change are in orange.

p1. How talented do you think the announcer is?/p

table border=0>

tr

td width=90 align=center> <input type=radio name=annoucertalent value="1"</td

td width=90 align=center> <input type=radio name=annoucertalent value="2"</td

td width=90 align=center> <input type=radio name=annoucertalent value="3"</td

td width=90 align=center> <input type=radio name=annoucertalent value="4"</td

td width=90 align=center> <input type=radio name=annoucertalent value="5"</td

td width=90 align=center> <input type=radio name=annoucertalent value="6"</td

td width=90 align=center> <input type=radio name=annoucertalent value="7"</td

/tr

tr

td width=90 align=center> 1 </td

td width=90 align=center> 2 </td

td width=90 align=center> 3 </td

td width=90 align=center> 4 </td

td width=90 align=center> 5 </td

td width=90 align=center> 6 </td

td width=90 align=center> 7 </td

/tr

tr

td width=90 align=center> Not At All/td

td width=90 align=center> </td

td width=90 align=center> </td

td width=90 align=center> </td

td width=90 align=center> </td

td width=90 align=center> </td

td width=90 align=center> Extremely/td

/tr

/table

  1. <table border=0This says “I don’t want a border”. If you want a border change it to: <table border=na0
  2. This is your question, so change it to whatever your question is <p1. How talented do you think the announcer is?/p
  3. annoucertalent : This is VERYimportant to change foreach question!!!!! It will become your column name for your data. If it is the same as any other question, the data will not separate because it will think it is the same question. This really sucks when it happens, I know!, so be careful!
  4. td width=90 align=center> <input type=radio name=annoucertalent value="7"</td> This code here tells the web that you want radio button and that if someone were to click on this particular button to report that as a number 7. You add this line as many times as you want or delete it, but you want to make sure that you don’t have all the values the same number (e.g. 7) or you won’t know which button they picked.
  5. td width=90 align=center> 1 </tdThis code displays a “1” underneath the button, you can change that if you wish
  6. td width=90 align=center> Not At All/tdThis will put the words “Not At All” underneath the “1” on the webpage. If you want it to be blank, it would just simply not say anything:td width=90 align=center> </td
  7. For an example see:

ii) Drop Down Boxes

  1. This is to select one (e.g. like when you need to select your state on an online form)
  2. In order to do this:

p21. What is your gender?

select NAME="gender">

<option VALUE="0">Select One

option VALUE="1">Male

option VALUE="2">Female

/select

/p

  1. p21. What is your gender? Again, this is the question you are asking
  2. select NAME="gender"> The gender is going to be the columns name in the excel sheet, so make sure it is the only one!
  3. option VALUE="0">Select One Select One is the choice the participant will see. The value is the number you want it to report as. So in this case Males = 1, Females = 2. By putting select one and = 0, you know if they answered it or not.
  4. For an example see:

iii) Free Response Boxes

  1. This is so people can type in whatever they want.
  2. It should look like this:

p25. What do you think this study is about?/p

textarea NAME="purpose" WRAP="Virtual" ROWS="4" COLS="100"</textareap

  1. p25. What do you think this study is about?/pAgain, your question…you change it to whatever you want it to be
  2. NAME="purpose" Again, this will be the name of the column for this question in excel. If you don’t change the name to something different it will not report correctly.
  3. ROWS="4" This determines how far down the webpage the box will go. This one will go down 4 rows, you can change it to however many or few you want.
  4. COLS="100"> This determines how far across the page the box will go, again you can change it at your will.
  5. For an example see:

iv) Small Text Boxes

  1. This is when you only want them to put a small number or something short.
  2. It should look like this:

p17. Please estimate the percentage of UVA students whose attitudes towards African Americans are similar to you. </p

pinput TYPE="text" NAME="uvaattitude" SIZE="10" MAXLENGTH="10"</p

  1. Again, this is the question you are asking :p17. Please estimate the percentage of UVA students whose attitudes towards African Americans are similar to you. </p
  2. Again, this is the column name in excel, if it is the same as any other name on the webpage, you won’t get the answer back properly. NAME="uvaattitude"
  3. You can change the size of the box by changing these numbers: SIZE="10" MAXLENGTH="10">
  4. For an example see:

A) To submit your data:

  1. This will put a “submit” button at the bottom of your page
  2. Enter this code:

p>Please click the Submit button. </p

p

<input TYPE="submit" NAME="Request" VALUE="Continue">

<input TYPE="reset" NAME="Clear" VALUE="Clear Form and Start Over">

</p

/form

br>Thank you for participating!

brbrbr

/body

/html

3. Notice that you closed the form, the body, and the html.

4)How to get the data back to you—spreadsheet ready

a)First you want to create a new folder for the data to be stored in (this way you can run and keep several different studies on your account without the data getting bunched into one directory)

  1. On a mac, you can log into Fetch and create a folder there, or access your home directory
  2. On a pc, don’t know so let me know….

b) UVA uses a program they created called Easyform

  1. To get it onto your account you:
  2. Log into your UNIX account
  3. via telenet—on a mac
  4. Select # 9 to log into UNIX
  5. type in:

cd public_html

  1. This changes your directory to your public_html directory
  1. then type in:

/contrib/bin/efsetup -d /home/jls9tp/public_html/survey/

  1. instead of “jls9tp” put your Email ID
  2. instead of “survey” put your folder’s name
  1. You will know if it worked if you see the following blurb on your UNIX account:

E-mail will be sent to:

Installing /home/mst3k/public_html/email.dat

Installing /home/mst3k/public_html/easyform.cgi

Installing /home/mst3k/public_html/easymail.cgi

Installing /home/mst3k/public_html/efresult.html

Installing /home/mst3k/public_html/Readme file.

All done.

5)How to get my webpage to know that I want the data to send to my account and where to send it to?

a)Inside your html code, you will put the following piece of code inbetween the </head> and <body> sections (if this doesn’t make sense now it will in the web page building section—I hope ):

<form action=" method="post">

b)instead of “mst3k” you will put your email id

c)If you want to get each piece of data emailed to you after it is submitted then you would use the following piece of code:

<form action=" method="post">

d)again, instead of “mst3k” you will put your email id

e)notice the only difference is “easyform” and “easymail”

6)So how do I get my data from my account?

a)You’ll have to log into your account, go into your folder, and download the data

b)The data is stored as a text file on your account it is called output.txt

c)The column names are stored in another text file called formkeys.dat

d)To open output.txt in excel:

  1. Download output.txt
  2. Mac—use Fetch; PC—use FTP
  3. Open Excel
  4. Click FILE, OPEN, and find and select output.txt

e)To open formkeys.dat in excel:

  1. Follow directions above
  2. The list will come in one column. To get them across the rows do the following:
  3. Copy the Column with all the names
  4. Open a new Excel Sheet
  5. Select the Row you want to paste into so the entire row is highlighted
  6. Click on EDIT, and PASTE SPECIAL
  7. In the Paste Special box, you will see a little checkbox that says TRANSPOSE
  8. Click OK, and it should work
  9. You can then copy that row and insert it into the excel sheet with the data.

7) So how do I randomize this thing anyway?

  1. To randomize, you need to have a “homepage”. I usually use this page as the instruction and informed consent page. You put the randomization code on this page, they click a link “Begin Study” and it will randomly take them to one of the several webpages you want
  2. The code is placed at the bottom of the page just before </body> </html> and looks like this:

centerscript language="Javascript"> <!--

var currentdate = 0

var theranlink = " "

var core = 0

function StringArray (n) {

this.length = n

for (var i =1; i<= n; i++) {

this[i] = ''

}

}

link = new StringArray(3)

link[0] = 'trial/group2.html'

link[1] = 'trial/group3.html'

link[2] = 'trial/group4.html'

var ran = 60/link.length

function ranlink () {

currentdate = new Date()

core = currentdate.getSeconds()

adcore = Math.floor(core/ran)

core = adcore

theranlink = link[core]

self.location = theranlink

}

document.write("<a href='javascript:ranlink()'<fontsize=10Begin Study/a>")

//-->

/script

/center

/body

/html

  1. This is the total # of webpages that you want randomized. In this case I have 3 pages: link = new StringArray(3)
  2. This is where you put the webpage name: link[0] = 'trial/group2.html'
  3. Note: You always begin with “0” (link[0]) and start counting up from there
  4. Here I’ve included the folder name trial that this study is stored in: 'trial/group2.html'
  5. However, this only works for Netscape. To use with Explorer, you will only put the file name: link[0] = 'group2.html'
  6. Note: Try it on both browsers, sometimes the no folder name works with both, sometimes it doesn’t….it is really weird
  7. For an example see
  8. Note: If you are using EXPLORER you may get an error message that says “The requested URL /~jls9tp/impression/impression/rate4.html was not found on (Error 404-NOT_FOUND).” All you have to do is take out the one extra impression. Explorer puts two folder names, it works find with Netscape. This is an example of the browser incompatibilities. You can resolve this by putting a note on your study saying you can only use one browser over the other…or have your Ras only use one browser.

8) So how do I know which data set is for which condition

  1. This can be solved by adding a hidden code that will be always be submitted with the page.
  2. The code looks like this and can be placed underneath the <form> command:

input TYPE="hidden" Name="condition" value="white defendant">