Make your own free website on Tripod.com

The Church of Universal Love and Music

 
 
 
 

BlackJack Source Code:

 <html>
<head><link rel="stylesheet" type="text/css" href="xpMenu.css">

<title>BlackJack</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<SCRIPT LANGUAGE="JavaScript">
var gameOver; var cardCount;
function Shuffle(max){
var num=Math.random()*max;
return Math.round(num)+1;
}
function getSuit(){
suit = Shuffle(4);
if(suit == 1) return "Spades";
if(suit == 2) return "Clubs";
if(suit == 3) return "Diamonds";
else return "Hearts";
}
function cardName(card){
if(card == 1) return "Ace";
if(card == 11) return "Jack";
if(card == 12) return "Queen";
if(card == 13) return "King";
return "" + card;
}
function cardValue(card,strWho){
if(card == 1) {
if(strWho =="You" && document.display.you.value >10){
document.display.say2.value=document.display.say2.value+" Low"; return 1;}
else return 11; }
if(card > 10) return 10;
return card;
}
function PickACard(strWho){
card = Shuffle(12);
suit = getSuit();
if(strWho =="You")
document.display.say2.value=(cardName(card) + " of " + suit);
else
document.display.say1.value=(cardName(card) + " of " + suit);
return cardValue(card,strWho);
}
function NewHand(form){
if(gameOver !=0)
{form.say1.value=("Hand in Play!"); form.say2.value=(""); return;}
else
{form.dealer.value = 0; form.you.value = 0; cardCount=0;
form.dealer.value = eval(form.dealer.value) + PickACard("Dealer");
form.you.value = eval(form.you.value) + PickACard("You");
gameOver= -1; cardCount+=1;}
}
function Dealer(form){
if (gameOver ==0)
{form.say1.value=("Deal the Cards!"); form.say2.value=(""); return;}
else
if(form.you.value<10)
{form.say1.value=("You cant stand below ten!"); form.say2.value=("Take a Hit!"); return;}
else
if (cardCount <2)
{form.say1.value=("Minimum 2 Cards!"); form.say2.value=("Hit Again!"); return;}
else
while(form.dealer.value < 17)
{form.dealer.value = eval(form.dealer.value) + PickACard("Dealer");}
}
function User(form){
if (gameOver ==0)
{form.say1.value=("Deal the Cards!"); form.say2.value=(""); return;}
else
{cardCount+=1; form.say1.value=("You Get...");
form.you.value = eval(form.you.value) + PickACard("You");}
if(form.you.value > 21)
{form.say1.value=("You Busted!");
gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
}
function LookAtHands(form){
if (gameOver ==0 || form.you.value<10 || cardCount <2){return;}
else
if(form.dealer.value > 21)
{form.say1.value=("House Busts!"); form.say2.value=("You Win!!");
gameOver=0; form.numgames.value=eval(form.numgames.value)+1;}
else
if(form.you.value > form.dealer.value)
{form.say1.value=("You Win!"); form.say2.value=("$$$$$$$$$$$$$$$");
gameOver=0; form.numgames.value=eval(form.numgames.value)+1;}
else
if(form.dealer.value == form.you.value)
{form.say1.value=("Game Tied!"); form.say2.value=("Try Again!");
gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
else
{form.say1.value=("House Wins!"); form.say2.value=("Tough Luck!");
gameOver=0; form.numgames.value=eval(form.numgames.value)-1;}
}
function setBj(){
gameOver=0; cardCount=0;
document.display.dealer.value="";
document.display.you.value="";
document.display.numgames.value="0";
document.display.say1.value=" Hit 'Deal'";
document.display.say2.value=" To Start!";
}
</script>

</head>

<body bgcolor="#FFFFFF" OnLoad="setBj()">
<center>
<TABLE cellSpacing=0 cellPadding=0 width="82%" border=0 align:"center">
<TR>
<TD width="100%" align="center">
<p align="center">
<img border="0" src="images/churchlogo.jpg" width="125" height="125">
</p>
</TD>
</TR>
</TABLE></center>
<p align="center"><FONT face=Ravie color=#ff0000 size=5>The Church of Universal Love and
Music</FONT>
<FONT FACE="Tahoma"><br> </FONT></p>
<table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> <td valign="top" width="245"> <table width="215" border="0" cellspacing="0" cellpadding="0">
<tr> <td colspan="3" height="28" background="images/menuup.gif"> <div align="center">
&nbsp;</div></td></tr> <tr> <td width="9" height="76" background="images/menuleft.gif">&nbsp;</td><td width="194" height="76">
<FONT FACE="Tahoma"><br><div>
<!-- *********************************Start Menu****************************** -->
<div class="mainDiv">
<div class="topItem">Quick Links</div>
<div class="dropMenu1">
<div class="subMenu1" style="display:none;">
<span class="subItem1"><a href="frontdoor.htm">Home</a></span><br>
<span class="subItem1"><a href="calendar.htm">Goings On</a></span><br>
<span class="subItem1"><a href="churchinfo.htm">Church Info</a></span><br>
<span class="subItem1"><a href="past-events.htm">Past Events</a></span><br>
</div><!-- *******************************End Menu************************** -->
</div><div>
<!-- *********************************Start Menu****************************** -->
<div class="mainDiv">
<div class="topItem">Mission</div>
<div class="dropMenu1">
<div class="subMenu1" style="display:none;">
<span class="subItem1"><a href="mission.htm">Mission Statement</a></span><br>
<span class="subItem1"><a href="comser.htm">Community Service</a></span><br>
<span class="subItem1"><a href="projects.htm">Projects</a></span><br>
</div><!-- *******************************End Menu************************** -->
</div><div>
<!-- *********************************Start Menu****************************** -->
<div class="mainDiv">
<div class="topItem">Support</div>
<div class="dropMenu1">
<div class="subMenu1" style="display:none;">
<span class="subItem1"><a href="donate.htm">Donations</a></span><br>
<span class="subItem1"><a href="support.htm">Support</a></span><br>
<span class="subItem1"><a href="products.htm">Products &amp; Services</a></span><br>
</div><!-- *******************************End Menu************************** -->
</div><div>
<!-- *********************************Start Menu****************************** -->
<div class="mainDiv">
<div class="topItem">Fun Stuff</div>
<div class="dropMenu1">
<div class="subMenu1" style="display:none;">
<span class="subItem1"><a href="fungames.htm">Fun & Games</a></span><br>
<span class="subItem1"><a href="educate.htm">Self Education</a></span><br>
<span class="subItem1"><a href="contact.htm">Contact Us</a></span><br>
</div><!-- *******************************End Menu************************** -->
</div><br>
</div></FONT></td><td width="12" height="76" background="images/menuright.gif">&nbsp;</td></tr>
<tr> <td colspan="3" height="28" background="images/menudown.gif">&nbsp;</td></tr> </table><FONT FACE="Tahoma"><br>
</FONT></td><td width="455" valign="top">
<table width="455" border="0" cellspacing="0" cellpadding="0" background="images/longmenu.gif" height="34">
<tr> <td><b><font face="Tahoma" size="4">Black Jack:</font></b></td></tr> </table>
<p>&nbsp;</p>
<p>&nbsp;<center>
<form name="display">
<table bgcolor="#c0c0c0" border="1" cellspacing="0" cellpadding="3">
<tr>
<td><center>Score:</center></td>
<td><center>Dealer</center></td>
<td><center><input type=text name="dealer" size="2"></center></td>
<td><center>Card(s): <input type=text name="say1" size="18" value=""></center></td>
</tr>
<tr>
<td><center><input type=text name="numgames" size="3" value="0"></center></td>
<td><center>Player</center></td>
<td><center><input type=text name="you" size="2"></center></td>
<td><center>Card(s): <input type=text name="say2" size="18" value=""></center></td>
</tr>
<tr>
<td><center><input type=button value="Deal" onClick="NewHand(this.form)"></center></td>
<td colspan=3><center>
<input type=button value="Stand" onClick="Dealer(this.form);LookAtHands(this.form);">
<input type=button value=" Hit " onClick="User(this.form)"></center></td></tr>
</table>
</form>
</center>

<p><center></p>
<P>&nbsp;</P>
<p align="left">&nbsp;</p>
<p align="right"><FONT FACE="Tahoma">&nbsp;</FONT></p><p align="right">&nbsp;</p></td></tr>
<tr> <td valign="top" width="245"> &nbsp;</td><td width="455" valign="top">
&nbsp;</td></tr> </table><FONT FACE="Tahoma"><br> </FONT><table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> <td> <div align="left"></div><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Tahoma">Copyright
2006 The Church of Universal Love and Music. All Rights Reserved</FONT></DIV><TABLE WIDTH="700" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="20" ALIGN="center">
<TR BGCOLOR="#000000"> <TD BGCOLOR="#336666"><DIV ALIGN="center">&nbsp;</DIV></TD></TR> </TABLE></td></tr>
</table>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-676573-1";
urchinTracker();
</script><script type="text/javascript" src="xpMenu.js"></script></body>
</html><center>
<span style="width: 100%; font-family: helvetica; font-size: 6px; Filter: Alpha(Opacity=0,FinishOpacity=0, Style=1);">
&nbsp;</span></center><br><br>
 


Copyright 2006 The Church of Universal Love and Music. All Rights Reserved