Script Categories













Games >>> Fortune Teller.

Just ask a yes or no question and the JavaScript fortune teller will reply.

Your question:
Your fortune teller says:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var answers = new Array(
"Without a doubt",
"Yes!",
"Probably so",
"It isn't likely",
"it's possible",
"Absolutely",
"Not a chance",
"Ask again",
"No",
"I doubt it",
"No Way"
);
function fortune() {
num = Math.round( (answers.length - 1) * Math.random());
return answers[num];
}
//  End -->
</script>
<center>
<form>
Your question:  <input type=text name=question size=40>
<input
type=button name=ask value="Ask" onClick="if (this.form.question.value!='') this.form.answer.value = fortune();"><br>
Your fortune teller says:  <input type=text name=answer size=40>
</form>
</center>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©