Как переместить это изображение http://svastara.info/.s/img/icon/download1.png в начало ? должен выглядеть примерно так: изображение Скачать сейчасКак перенести изображение в начало Загрузить сейчас в javascript-коде?
var CountdownTimer = function(id, count, imgurl) { this.construct(id, count, imgurl); }
CountdownTimer.prototype = {
construct: function(id,count,imgurl) {
this.id = id;
this.object = document.getElementById(id);
this.count = count;
this.interval = null;
this.counted = false;
this.img = new Image(); // preload
this.img.src = imgurl;
this.img.border = "0";
(function(obj) {
obj.object.onclick = function() {
return obj.onclick();
};
})(this);
},
tick: function() {
this.count--;
this.render();
if(this.count == 0){
clearInterval(this.interval);
this.interval = null;
this.object.appendChild(this.img);
}
},
onclick: function() {
if(!this.counted) {
this.counted = true;
this.render();
(function(obj) {
obj.interval = setInterval(function() {
obj.tick();
},1000);
})(this);
return false;
} else if(this.count == 0)
return true;
else
return false;
},
render: function() {
if(this.count > 0)
this.object.innerHTML = "Download (" + this.count + " second" + (this.count == 1 ? "" : "s") + ")";
else
this.object.innerHTML = "Download Now";
}
};
window.onload = function() {
var c = new CountdownTimer("delayed",3,"http://svastara.info/.s/img/icon/download1.png");
};
<div>
<a id="delayed" class="stop" href="http://www.epiclosers.com/">Download (30sec)</a>
</div>
Я ничего не знаю о javascript, то, что я хочу, это то, о чем я спросил выше, если вы можете помочь просто помочь, я не здесь, чтобы вы научили меня. И да, я знаю, что этот код слаб, если любой 10-летний может передать его, если он знает, как, но большинство из них не знает ... Так что, пожалуйста, ответьте на мой вопрос выше. – Brazen
Я ответил на него в первом сообщении. –
Cavan в значительной степени мертв: CSS - ваш друг. Таймер загрузки и все, что потребует JS, но все это можно упростить еще больше. – BryanH