アプリ版:「スタンプのみでお礼する」機能のリリースについて

javascriptでカウントダウン終了後に別ページに飛ばすリンクを表示したいのですが、どのようにすれば教えていただけますでしょうか?
下記スクリプトではカウントダウン終了時に「終了しました」と表示されます。
その「終了しました」にリンクを貼りたいです。

<script language="JavaScript" type="text/javascript">
function CountdownTimer(elm,tl,mes){
this.initialize.apply(this,arguments);
}
CountdownTimer.prototype={
initialize:function(elm,tl,mes) {
this.elem = document.getElementById(elm);
this.tl = tl;
this.mes = mes;
},countDown:function(){
var timer='';
var today=new Date();
var day=Math.floor((this.tl-today)/(24*60*60*1000));
var hour=Math.floor(((this.tl-today)%(24*60*60*1000))/(60*60*1000));
var min=Math.floor(((this.tl-today)%(24*60*60*1000))/(60*1000))%60;
var sec=Math.floor(((this.tl-today)%(24*60*60*1000))/1000)%60%60;
var milli=Math.floor(((this.tl-today)%(24*60*60*1000))/10)%100;
var me=this;

if( ( this.tl - today ) > 0 ){
if (day) timer += '<span class="day">'+day+':</span>';
if (hour) timer += '<span class="hour">'+hour+':</span>';
timer += '<span class="min">'+this.addZero(min)+':</span><span class="sec">'+this.addZero(sec)+':</span><span class="milli">'+this.addZero(milli)+'</span>';
this.elem.innerHTML = timer;
tid = setTimeout( function(){me.countDown();},10 );
}else{
this.elem.innerHTML = this.mes;
return;
}
},addZero:function(num){ return ('0'+num).slice(-2); }
}
function CDT(){
var tl = new Date('2013/2/1 00:00:00');
var timer = new CountdownTimer('CDT',tl,'終了しました');
timer.countDown();
}
window.onload=function(){
CDT();
}
</script>

A 回答 (1件)

HTML上でid=CTDの要素が何になっているのか不明ですが…



「終了しました」の文字列の代わりに、その要素内に入れたいHTMLソースを記述しておけばそれで表示されませんか?
例えば  '<a href="~~">hoge</a>' とか。
    • good
    • 0
この回答へのお礼

できました!ありがとうございます!!

お礼日時:2013/01/11 17:24

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!