GIF player
HTML
<button id="srk">Shoryuken</button>
<div id="c"></div>
JavaScript
function Gif(el, url, length) {
this.el = el;
this.url = url;
this.length = length;
this.timer = null;
this.clear = function() {
clearTimeout(this.timer);
document.getElementById(this.el).innerHTML = '';
}
this.start = function() {
this.clear();
var img = new Image();
img.src = url+'?'+new Date().getTime();
document.getElementById(this.el).appendChild(img);
var gif = this;
this.timer = setTimeout(function(){ gif.clear() }, this.length);
}
}
var g = new Gif('c', 'http://img3.wikia.nocookie.net/__cb20100621210012/streetfighter/images/6/69/Ken\'s_Shoryuken.gif', 1700);
document.getElementById('srk').onclick = function(){ g.start() };