I have a div that is used for a piece in a game of checkers:
<div class="blackCoin" ondblclick="makeKing(this)">
When, for example double clicked, I want to make the piece a king by adding a crown on top of the existing background color:
function makeKing(obj){
obj.style.backgroundImage = "url('http://ift.tt/1F7udTe')";
}
Here is the full JS Fiddle
Aucun commentaire:
Enregistrer un commentaire