Ruby on Rails Friday, March 30, 2018

Section of html code

<div id="dealersCards">
<span id = "D0"></span>
<span id = "D1"></span>
<span id = "D2"></span>
<span id = "D3"></span>
<span id = "D4"></span>
<span id = "D5"></span>
<span id = "D6"></span>
<span id = "D7"></span>
</div>

Corresponding javasript code

function displayPlayerOneInitialCards()
{
length = dealerCards.length;
for( dealerCount = 0; dealerCount < length; dealerCount++) 
newCard = dealerCards[dealerCount]
if(dealerCount == 0)
{
var cardToDisplay = newCard.cardFaceDown;
}
if(dealerCount == 1)
{
var cardToDisplay = newCard.cardToDisplay;
}
dealerIdName = 'D';
dealerIdName   = dealerIdName  + dealerCount.toString();
fileNameCard= '<img  width="80" height="128" src="images/'+(cardToDisplay.trim())+'" alt="Card"/>';
document.getElementById(dealerIdName).innerHTML = fileNameCard;
}
}

Images are in app/assets

Error message eg 

No route matches [GET] "/game/BlackJack/images/H3.gif"


This works in the broswer but wanting ity to work with Rails

Any suggestion please.

Cheers Dave



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e145956e-37ae-4e70-a91b-2bd7e1ab158f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment