admin管理员组

文章数量:815885

倒计时显示图片

js页面

//倒计时  显示图片var count = 3;function test4() {var div2 = document.getElementById("div2");div2.align = "center";div2.style.fontSize = "50px";div2.innerHTML = count--;if(count == -1){//count = 10;clearInterval(label);div2.innerHTML = "";var img = document.createElement("img");img.style.width = "60%";img.src = "img/hhh.jpg";img.onclick = function(){var i = Math.floor(Math.random()*5+1);img.src = "img/" + i +".jpg";}div2.appendChild(img);}}function test5(){label = setInterval(test4, 1000);}//注意图片路径

页面

<input type="button" onclick="test4()"value="倒计时"><input type="button" onclick="test5()"value="点击倒计时显示图片"><div id="div2"></div></body>

本文标签: 倒计时显示图片