dimanche 29 mars 2015

Change text to img using JavaScript

I need to change text in my html document into a small image on html load using JavaScript.


I am new to using JavaScript, so please be patient with me. Here is the code I tried:



<body onload="stickers()">
<span id="bonusIMG">Bonus</span>
<script>
function stickers() {
document.getElementById('bonusIMG').innerHTML = <img src="http://ift.tt/1xNz9eV" alt="Bonus Added" width="25" height="25" />;
</script>

Aucun commentaire:

Enregistrer un commentaire