1. Copy dalam <head>
<!--
Page published in 1997 on the JavaScript Page
http://www.oocities.org/CollegePark/Quad/3400
(c) 1997 Semian Software, Script by Gert-Jan Brink: gbrink@dds.nl
Modify and use anyway you want, just mention this site.
-->
<SCRIPT>
<!-- Hide from old browsers
fruits1 = new Array(6);
fruits2 = new Array(6);
fruits3 = new Array(6);
fruits1[0] = "BAR";
fruits1[1] = "cherry";
fruits1[2] = "apple";
fruits1[3] = "star";
fruits1[4] = "bell";
fruits2[0] = "apple";
fruits2[1] = "star";
fruits2[2] = "BAR";
fruits2[3] = "bell";
fruits2[4] = "cherry";
fruits3[0] = "bell";
fruits3[1] = "star";
fruits3[2] = "cherry";
fruits3[3] = "BAR";
fruits3[4] = "apple";
// Because this random function is time driven, we have
to use 3
// arrays to prevent to many wins ;)
function random(limit) {
today = new Date();
num = today.getTime();
num = Math.round(Math.abs(Math.sin(num*today.getSeconds())
* 1000000)) % limit;
return num;
}
var yourCredit = 250;
function spin() {
if (yourCredit <= 0) {
alert("You have no credit....");
return(false);
}
yourCredit -= 5;
document.FGame.fruitOne.value = fruits1[random(5)];
document.FGame.fruitTwo.value = fruits2[random(5)];
document.FGame.fruitThree.value = fruits3[random(5)];
if ((document.FGame.fruitOne.value ==
// All three
document.FGame.fruitTwo.value)
&&
(document.FGame.fruitTwo.value
==
document.FGame.fruitThree.value))
{
yourCredit
+= 25;
} else {
if (document.FGame.fruitOne.value
== // 1 & 2
document.FGame.fruitTwo.value) {
yourCredit += 15;
} else {
if (document.FGame.fruitOne.value
== // 1 & 3
document.FGame.fruitThree.value) {
yourCredit += 5;
} else {
if (document.FGame.fruitTwo.value == // 2 & 3
document.FGame.fruitThree.value) {
yourCredit += 10;
}
}
}
}
document.FGame.credit.value = yourCredit;
return(true);
}
function init() {
document.FGame.fruitOne.value
= "BAR";
document.FGame.fruitTwo.value
= "BAR";
document.FGame.fruitThree.value
= "BAR";
document.FGame.credit.value
= 250;
}
// Unhide -->
</SCRIPT>
2.Copy dalam <body>
<CENTER><FORM NAME="FGame"><INPUT TYPE="txt" NAME="fruitOne"
VALUE="BAR" Size="10"><INPUT TYPE="txt" NAME="fruitTwo"
VALUE="BAR" Size="10"><INPUT TYPE="txt" NAME="fruitThree" VALUE="BAR"
Size="10"></CENTER>
<CENTER><INPUT TYPE="txt" NAME="credit"
VALUE="250" Size="10"></CENTER>
<CENTER><INPUT TYPE="button" NAME="Try" VALUE="Spin" OnClick="spin()"><INPUT
TYPE="button" NAME="Init" VALUE="Again" onClick="init()"></FORM> |