<!DOCTYPE html>
<head>
<title>flash_anzan</title>
</head>
<body>
<script>
<!--
var img = new Array();
img[0] = new Image();
img[0].src = "http://www.onlyonehappy.top/1.JPG";
img[1] = new Image();
img[1].src = "http://www.onlyonehappy.top/2.JPG";
img[2] = new Image();
img[2].src = "http://www.onlyonehappy.top/3.JPG";
img[3] = new Image();
img[3].src = "http://www.onlyonehappy.top/null.JPG";
img[4] = new Image();
img[4].src = "http://www.onlyonehappy.top/0.JPG";
var id=0;
var s=0;
function appear_f1(){
document.getElementById("IMG1").src = img[0].src;
s += 1;
}
function appear_f2(){
document.getElementById("IMG1").src = img[1].src;
s += 2;
}
function appear_f3(){
document.getElementById("IMG1").src = img[2].src;
s += 3;
}
function appear_f4(){
id++;
var timer = window.setTimeout("appear_f4()", 1000);
var rand = Math.floor(Math.random()*3);
if (rand==0){
appear_f7();}
else if(rand==1){
appear_f8();}
else{
appear_f9();}
if(id==5){
clearTimeout(timer);
id=0;}
}
function appear_f5(){
alert("合計は、"+s+"です。");
s=0;
}
function appear_f6(){
document.getElementById("IMG1").src = img[3].src;
}
function appear_f7(){
timerID = window.setTimeout("appear_f1()", 800);
appear_f6();
}
function appear_f8(){
timerID = window.setTimeout("appear_f2()", 800);
appear_f6();
}
function appear_f9(){
timerID = window.setTimeout("appear_f3()", 800);
appear_f6();
}
// -->
</script>
<form>
<IMG id="IMG1" name="num1" alt="" src="0.JPG">
<input type ="button" style = "position: absolute; left:50%; top: 50%"/ name = "b4" value = "start" onclick = "appear_f4()">
<INPUT id="Button2" style = "position: absolute; left:65%; top: 50%"/ onclick="appear_f5()" value="sum" type="button" name="sum">
</form>
</body>
</html>
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme