|
|
SLOT MACHINE (VB Script Version)
VBS Code <html>
<head>
<SCRIPT LANGUAGE="VBScript">
'
' Random Generating Sub
'
option explicit
sub button1_onclick()
dim i
document.Slot.prizemessage.value = "wait ... generating numbers"
if document.Slot.credit.value < 1 then
document.Slot.prizemessage.value = "Get more credit before you play on! Press button for more credit"
else randomize
for i=0 to 100
document.Slot.prizemessage.value = "... generating numbers"
document.Slot.number1.value = int(10*rnd())
document.Slot.number2.value = int(10*rnd())
document.Slot.number3.value = int(10*rnd())
next
document.Slot.prizemessage.value = _
PrizeMessage( _
document.Slot.number1.value, _
document.Slot.number2.value, _
document.Slot.number3.value)
end if
end sub
function PrizeMessage(num1, num2, num3) if num1=num2 and num1=num3 then
prizemessage = "Congratulations, three numbers equal! You won $20!"
document.Slot.credit.value = document.Slot.credit.value + 19'+ $20 minus $1 stake
else
if (num1=num2) or (num1=num3) or (num2=num3) then
prizemessage = "Two numbers equal! You won $2!"
document.Slot.credit.value = document.Slot.credit.value + 1 ' +$2 minus $1 stake
else
prizemessage = "Sorry, you lost $1!"
document.Slot.credit.value = document.Slot.credit.value - 1
end if
end if
end function </Script> </head> <body> <h3>
SLOT MACHINE <font color="#FF0000">(VB Script Version)</font></h3>
<p><form name=Slot>
<input id=text1 name=number1 size=4 readonly title="yyyy">
<input id=text1 name=number2 size=4 readonly>
<input id=text1 name=number3 size=4 readonly>
<br><input id=button1 name=button1 type=button value="Play for $1">
<br>
<input id=text1 name=prizemessage size=70 readonly>
<p>
<b> Your remaining credit :</b> $<input id=text1 name=credit size=4 readonly value=10>
<br>
<input id=button2 name=button2 type=button value="Get $10 to play"
onclick = 'document.Slot.credit.value = 10'> <br> (press if you run out of money)
</form>
</body>
</html>
|
|