Skip to content

Instantly share code, notes, and snippets.

@johnjosephhorton
Created November 14, 2010 23:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjosephhorton/676230 to your computer and use it in GitHub Desktop.
Save johnjosephhorton/676230 to your computer and use it in GitHub Desktop.
Some code for doing simple A/B-type randomization for locally-hosted HITs on Amazon Mechanical Turk (MTurk)
<script>
function rand(){
if (Math.random() > .5){
document.getElementById('boss').style.visibility="hidden";
} else {
document.getElementById('requester').style.visibility="hidden";
}
}
</script>
<p>What country are your from?</p>
<p><input type="radio" name="country" value="US" />US<br />
<input type="radio" name="country" value="India" />India<br />
<input type="radio" name="country" value="Other" />Other</p>
<div hidden="false" id="boss">
<h3>What percentage (between 0 and 100) of Employers in your home country would you estimate treat workers honestly and fairly?</h3>
<input type="text" id="real" name="real" /></div>
<div hidden="false" id="requester">
<h3>What percentage (between 0 and 100) of Mechanical Turk Requesters would you estimate treat workers honestly and fairly?</h3>
<input type="text" id="amt" name="amt" /></div>
<p><iframe height="1" onload="rand()"></iframe></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment