\"doctype\">Please help me finish my code, Draw Card button will display 5 rando
ID: 3536126 • Letter: #
Question
"doctype">Please help me finish my code, Draw Card button will display 5 randomly selected cards
and total text box will display the total values of the cards. also i need a flush counter,
which counts everytime you get a flush.(all cards same type)
<
"start-tag">html
>
<
"start-tag">head
>
<script
"attribute-name">type
"attribute-value">text/javascript
function start()
{
var Card1Image=document.getElementById("card1")
var Card2Image=document.getElementById("card2")
var Card3Image=document.getElementById("card3")
var Card4Image=document.getElementById("card4")
var Card5Image=document.getElementById("card5")
assignCards();
}
function assignCards()
{
for(var i = 0;i<1 span="">3;++i)
Cards[i]="card"+(i+1)+"h";
for(var i = 13;i<2 span="">6;++i)
Cards[i]="card"+(i-12)+"c";
for(var i = 26;i<3 span="">9;++i)
Cards[i]="card"+(i-23)+"s";
for(var i = 39;i<5 span="">2;++i)
Cards[i]="card"+(i-34)+"d";
}
var Cards=new Array(52);
function drawCards()
{
shuffle();
setImage(cardImage,o)
}
function shuffle()
{
for(var i=0;i<5 span="">3;++i)
{
var temp= Cards[i]
Cards[i]=Cards[j]
Cards[i]=temp;
}
}
function setImage(CardImage,i)
{
cardImage.setAttribute("http://webdrive.csun.edu/sp67336/Project14/card1h.jpg",Cards[i]+".jpg");
}
var suit=Cards[0].charAt(Cards[0].length()-1)
var suit=new Array(5);
for (var i=0;i<5 span="">;++i)
suit[i]=cards[i].charAt(Cards[i].length()-1);
var s = suite[0];
for (var i=1;i<5 span="">;++i)
if (s != suite[i])
{
return false;
}
else{
return true;
}
"end-tag">script
>
"end-tag">head
>
<
"start-tag">body
>
"end-tag">body
>
html>
Explanation / Answer
//Assuming that cards are numbered from 1 to 52 //Please check the code now and modify the links to the actual links //If u want to display back of the card use a inline src attribute in the image tag . //And if u want numbering in formatt such as 1h.jpg have a method which converts 1-52 to that format //And your question isnt very clear Card Game Draw Cards
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.