아래처럼 1분후에<div class="002">나타나는데 여기에서 30초후에<div class="003">을 출력하려합니다.
본문
아래처럼 1분후에<div class="002">나타나는데 여기에서 30초후에<div class="003">을 출력하려합니다.
고수님 도와주세요
<SCRIPT type="text/javascript">
window.onload=function(){
var maxtime = 1 * 60;
var div1=document.getElementsByClassName("001")[0];
var div2=document.getElementsByClassName("002")[0];
var timer=document.getElementById("timer");
div1.style.display="block";
div2.style.display="none";
(function CountDown(){
var minutes=parseInt(maxtime/60);
var seconds=parseInt(maxtime%60);
timer.innerHTML=minutes+"分 "+seconds+"秒";
if(--maxtime>=0){
setTimeout(CountDown,1000);
}else{
div1.style.display="none";
div2.style.display="block";
}
})();
}
</SCRIPT>
<div class="001"><div id="timer" style="color:#000;"></div></div>
<div class="002">30초</div>
<div class="003">감사합니다</div>
답변 1
<SCRIPT type="text/javascript">
window.onload=function(){
var maxtime = 1 * 60;
var maxtime2 = 1 * 30;
var div1=document.getElementsByClassName("001")[0];
var div2=document.getElementsByClassName("002")[0];
var div3=document.getElementsByClassName("003")[0];
var timer=document.getElementById("timer");
div1.style.display="block";
div2.style.display="none";
div3.style.display="none";
(function CountDown(){
var minutes=parseInt(maxtime/60);
var seconds=parseInt(maxtime%60);
timer.innerHTML=minutes+"분 "+seconds+"초";
if(--maxtime>=0){
setTimeout(CountDown,1000);
}else{
div1.style.display="block";
div2.style.display="block";
minutes=parseInt(maxtime2/60);
seconds=parseInt(maxtime2%60);
timer.innerHTML=minutes+"분 "+seconds+"초";
if(--maxtime2>=0){
setTimeout(CountDown,1000);
}else{
div1.style.display="none";
div2.style.display="none";
div3.style.display="block";
}
}
})();
}
</SCRIPT>
<div class="001"><div id="timer" style="color:#000;"></div></div>
<div class="002">30초</div>
<div class="003">감사합니다</div>