Wanting help to load images using document.getElementById()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Wanting help to load images using document.getElementById()

David Merrick
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 [hidden email].
To post to this group, send email to [hidden email].
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.