<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Error you did not post any "+shortFieldName+" , try again.");
return false;
}
else
return true;
}
// End -->
</script>
</head>
<table border="1" cellpadding="0" cellspacing="0"
bgcolor="#CCCCCC" bordercolor="#000000">
<tr>
<td><font size="2" face="MS Sans Serif">Instructions: <br>
Type a question in the text-field and press the button (or
enter button).<br>
If the answer turns out </font><font color="#0000FF"
size="2" face="MS Sans Serif">blue</font><font size="2"
face="MS Sans Serif"> then the answer is possitive. <br>
If the answer turns out </font><font color="#FF0000"
size="2" face="MS Sans Serif">red</font><font size="2"
face="MS Sans Serif"> then the answer is negative.<br>
If the answer turns out black then Im not sure what to
answer...</font></td>
</tr>
</table><hr size="1" align="left" width="408" color="#000000">
<font size="2" face="MS Sans Serif">
<br><br>
<b>Ask the magic 8ball a question!</b>
<br>
<form onSubmit="return checkrequired(this)" method=post action='<? echo
$PHP_SELF; ?>'>
<input type=text size=31 name="requiredquestion" value='<? echo $question;
?>'>
<br>
<input type=submit value='Let us here the answer.. shall we?'></form><br>
<?
if (isset($requiredquestion)) {
$answers = array( "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Yes</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">No</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Of Course</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Never</font>",
"Maybe",
"Theres a Chance",
"What do you think I am, psychic?",
"Sometimes",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Im quit sure about that!</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Thats probably true</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Hell no..</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Dont even think about it....</font>",
"Maby , maby not",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">You may count on it</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">The chanse is quit as big as seeing Jay Leno in a
g-string</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">I would not even concider it..</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">I must say yes...</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Damnd right ...</font>",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Sure thing.</font>.",
"<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Hahah your kidding right?</font>",
"<font face=\"MS Sans Serif\" size =\"2\"
color=\"blue\">If you're lucky</font>");
srand((double) microtime() * 1000000);
$count = count($answers);
echo "You asked:<b> ";
echo $requiredquestion;
echo "</b><br><br>and the answer is: <b> " .
$answers[rand(0,$count)];
}
?>
<br><br><hr size="1" align="left" width="408" color="#000000">
Created by <a href="mailto:[email protected]">Jonas Ljungkvist</a> - Source is
aviable as [<a href="8ball.txt">txt</a>/<a href="source.html">html</a>]
</html>