<html>
<head>
<title>slot</title>
<script src="jquery.js"></script>
<script src="sample.js"></script>
</head>
<body onload="sample()">
<p id="memo"></p>
<input id="bt" type="button" value="stop" />
<input id="bt2" type="button" value="start" />
</body>
</html>
var x;
var p;
var z1 = new Array();
var z2 = new Array();
var z3 = new Array();
function sample(){
for (s = 1; s < 101;s++ ){
z1[s] = "a1.gif";
if(Math.random()>0.2)z1[s]="a2.gif";
if(Math.random()>0.4)z1[s]="a3.gif";
if(Math.random()>0.6)z1[s]="a4.gif";
if(Math.random()>0.8)z1[s]="a5.gif";
if(Math.random()>0.9)z1[s]="a6.gif";
}
for (s = 1; s < 101;s++ ){
z2[s] = "a1.gif";
if(Math.random()>0.2)z2[s]="a2.gif";
if(Math.random()>0.4)z2[s]="a3.gif";
if(Math.random()>0.6)z2[s]="a4.gif";
if(Math.random()>0.8)z2[s]="a5.gif";
if(Math.random()>0.9)z2[s]="a6.gif";
}
for (s = 1; s < 101;s++ ){
z3[s] = "a1.gif";
if(Math.random()>0.2)z3[s]="a2.gif";
if(Math.random()>0.4)z3[s]="a3.gif";
if(Math.random()>0.6)z3[s]="a4.gif";
if(Math.random()>0.8)z3[s]="a5.gif";
if(Math.random()>0.9)z3[s]="a6.gif";
}
p = 1;
x=100;
$("#bt").click(function(){
x=200;
});
$("#bt2").click(function(){
x=100;
});
game();
}
function game(){
var timer;
var delay = 100;
var loop = function () {
if (x < 150) p = p + 1;
if (p > 100) p = 1;
paint();
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
loop();
}
function paint(){
var str;
str = pic(z1[p]) + "<br>";
str = str+pic(z2[p]) + "<br>";
str = str+pic(z3[p]) + "<br>";
$("#memo").html(str);
}
function pic(pp){
var str = "<img src=\""
str = str + pp;
str=str+ "\" width=\"100\" height=\"100\">";
return str;
}
最終更新:2015年05月10日 12:39