<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function jeopardy(number){
var toTell = question[number]
$("#question").text(toTell);
whichone = number
document.getElementById("alert").innerHTML = ""
}
function checkAnswer(){
points = parseInt(document.getElementById("btn" + whichone).value)
var answer = word[whichone]
if(whichone == "test"){
$("#alert").text("Please choose a catorgory.")
return
}
else{
$("#alert").text("")
var answercheck = $("#answercheck").val()
if(answercheck == answer){
$("#alert").text("Well Done!")
pointInGame = parseInt(pointInGame) + points
document.getElementById("btn" + whichone).disabled = "disabled"
whichone = "test"
errorcount = 0
document.getElementById("answercheck").value = ""
document.getElementById("score").innerHTML = pointInGame
}
else{
errorcount++
if(errorcount == 3){
document.getElementById("btn" + whichone).disabled = "disabled"
$("#alert").text("Sorry, but you have already had 3 tries. Answer: " + answer)
var holdPoint = parseInt(pointInGame) - points
alert(holdPoint)
pointInGame = holdPoint
document.getElementById("score").innerHTML = pointInGame
whichone = "test"
errorcount = 0
document.getElementById("answercheck").value = ""
return
}
$("#alert").text("I'm sorry, please try again. Attempts: " + errorcount)
}
}
}
/*function gameOver(){
var btnCheck = new Array(word.length)
for(var btnrun = 0; btnrun <= word.length; btnrun++){
if ( $("#btn"+btnrun).prop( "checked" ) ){
btnCheck[btnrun] = 0
}
else{
btnCheck[btnrun] = 1
}
}
var checkbuttons = 0
for(var checkallbtn = 0; checkallbtn <= word.length; checkallbtn++){
checkbuttons = checkallbtn + btnCheck[checkallbtn]
}
if(checkbuttons == 0){
alert("You Win!")
}
}
*/
</script>
</head>
<body>
<h1 style="font-family">Jeopardy!</h1>
<div id="question" style="color:red"></div>
<div id="alert" style="color:blue"></div>
<input type="text" id="answercheck" maxlength="30">
<input type="button" onclick="checkAnswer()" value="Check Answer">
<script type="text/javascript">
var pointInGame = 0
var errorcount = 0
var points;
var question= ["To entertain with food/drink/storytelling",
"Expressed briefly and simply; succinct",
"Violenty hot; drying or scorching with heat",
"Slight or inferior in power, size, or inportance: weak",
"The action of understanding, being aware of, being sensitive to, and vicariously experience the feelings, thoughts, and experience of another",
"1. Law: To abate, annul, overthrow, or make void 2.To crush; to subdue;",
"Biting, harsh, caustic",
"To hate, detest",
"1. Abundantly provided, filled, complete 2.Abundantly fed",
"1. Shameless or impudent 2. To face boldly or shamelessy",
"1. A book containing words with the definition of each; a dictionary 2. The vocabulary of a person",
"Irritably or beevishly sensitive : touchy",
"1. To rise to or form a summit 2. To reach the highest or a climactic or decisive point",
"Noun: A scoundrel; an evildoer; a villain Adjective: Disbelieving; behaving badly.",
"Making a loud outcry; clamorous; noisy",
"1. Any of various low conical-shelled marine mollusks that adhere tightly to rocks 2.A person who sticks to something (idea, person or thing)",
"To move in, or have, waves; to vibrate; to wave",
"1. A detached shoot or twig of a plant used for grafting. 2. A descendant; an heir",
"Dash or flamboyance in manner or style",
"Habitually silent; not inclined to talk",
"To climb with difficulty, or on all fours; to scramble",
"A poorly built house; hut",
"A special charm or public appeal",
"To praise highly; to glorify; to exalt",
"Noisily rough; rowdy; marked by high spirits",
"1. Joking or jesting 2. Meant to be humorous or funny: not serious"
]
var word = ["regale", "concise", "torrid", "puny", "empathy", "quash", "acrimonious", "abhor", "replete", "brazen", "lexicon", "tetchy", "culminate", "miscreant", "vociferous", "limpet", "undulate", "scion", "panache", "taciturn", "clamber", "hovel", "charisma", "extol", "boisterous", "facetious"]
var whichone = "test"
var whichword;
function fillin(){
if(whichword < 5){
$("#question").before($("<input>", {value: 100, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
else if(whichword < 10){
$("#question").before($("<input>", {value: 200, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
else if(whichword < 15){
$("#question").before($("<input>", {value: 300, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
else if(whichword < 20){
$("#question").before($("<input>", {value: 400, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
else if(whichword < 25){
$("#question").before($("<input>", {value: 500, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
else if(whichword < 30){
$("#question").before($("<input>", {value: 600, id: "btn"+whichword, type:"button", onclick:"jeopardy(" + whichword + ")"}))
}
}
$(document).ready(function() {
for(var wordcount = 0; wordcount <= word.length; wordcount++){
if(wordcount == 6 || wordcount == 11 || wordcount == 16 || wordcount == 21 || wordcount == 26 || wordcount == 31){
$("#question").before($("<br>"))
fillin()
whichword = wordcount
}
else{
fillin()
whichword = wordcount
}
}
});
</script>
</body>
</html>
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |