8ball/8.html

50 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2020-01-25 11:41:05 +00:00
<!DOCTYPE html>
<html>
<head>
<style type="text/css">body{margin:40px
auto;max-width:650px;line-height:1.6;font-size:18px;color:#444;padding:0
10px}h1,h2,h3{line-height:1.2}</style>
<script type="text/javascript">
function ask() {
var ballray=["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."]
i=Math.floor(Math.random() * 20)
console.log(ballray[i])
document.getElementById("result").innerHTML = ballray[i]
}
</script>
</head>
<body>
<h2>Ask the spooky 8ball anything</h2>
<form>
Question<br>
<input type="text" name="question">
<button onclick="ask()" type="button">Ask!</button>
</form>
<p id="result"></p>
<p>It's an array of 20 answers and it picks one at random, I made this in 12 minutes for a laugh</p>
<p> + 5 minutes for a bug and dat CSS</p>
</body>
</html>