■66872 / inTopicNo.1) |
JAVAを使ったスロットマシン |
□投稿者/ GARO (1回)-(2013/05/31(Fri) 21:41:16)
|
分類:[Java]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta name="robots" content="noindex,nofollow,noarchive" />
<script type="text/javascript">
<!--
myImageCnt = 11;
myImage = new Array(
"kuji0.gif",
"kuji1.gif",
"kuji2.gif",
"kuji3.gif",
"kuji4.gif",
"kuji5.gif",
"kuji6.gif",
"kuji7.gif",
"kuji8.gif",
"kuji9.gif",
"kuji10.gif"
);
myBuffer = new Array(myImageCnt);
for(i=0; i<myImageCnt; i++){
myBuffer[i] = new Image();
myBuffer[i].src = myImage[i];
}
myStartFlg = 0;
myStopFlg1 = 0;
myStopFlg2 = 0;
myStopFlg3 = 0;
myStopFlg4 = 0;
function myStart(){
if (myStartFlg == 0){
myStartFlg = 0;
myStopFlg1 = -1;
myStopFlg2 = -1;
myStopFlg3 = -1;
myStopFlg4 = -1;
myLoop();
}
}
function myLoop(){
if (myStopFlg1==-1||myStopFlg2==-1||myStopFlg3==-1||myStopFlg4==-1){
if (myStopFlg1==-1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg1.src = myBuffer[myRnd].src;
}
if (myStopFlg2==-1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg2.src = myBuffer[myRnd].src;
}
if (myStopFlg3==-1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg3.src = myBuffer[myRnd].src;
}
if (myStopFlg4==-1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg4.src = myBuffer[myRnd].src;
}
setTimeout( "myLoop()" , 50 );
}else{
myStartFlg = 0;
}
}
function myStop1(){
if (myStopFlg1 == -1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg1.src = myBuffer[1].src;
myStopFlg1 = myRnd;
}
}
function myStop2(){
if (myStopFlg2 == -1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg2.src = myBuffer[9].src;
myStopFlg2 = myRnd;
}
}
function myStop3(){
if (myStopFlg3 == -1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg3.src = myBuffer[1].src;
myStopFlg3 = myRnd;
}
}
function myStop4(){
if (myStopFlg4 == -1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg4.src = myBuffer[9].src;
myStopFlg4 = myRnd;
}
}
// -->
</script>
<style type="text/css">
input.button1 { height:100px; width: 160px; }
input.button2 { height:100px; width: 655px; }
body {
background-color: #000;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=unicode" />
</head>
<body>
<table border="0">
<tr>
<td><img src="kuji.gif" name="myFormImg1"></td>
<td><img src="kuji.gif" name="myFormImg2"></td>
<td><img src="kuji.gif" name="myFormImg3"></td>
<td><img src="kuji.gif" name="myFormImg4"></td>
</tr>
<tr>
<td><center><form><input type="button" value="STOP" onclick="myStop1()" class="button1"></form></center></td>
<td><center><form><input type="button" value="STOP" onclick="myStop2()" class="button1"></form></center></td>
<td><center><form><input type="button" value="STOP" onclick="myStop3()" class="button1"></form></center></td>
<td><center><form><input type="button" value="STOP" onclick="myStop4()" class="button1"></form></center></td>
</tr>
<tr>
<td>
<BR>
<BR>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<form><input type="button" value="START" onclick="myStart()" class="button2"></form>
</td>
</tr>
</table>
</body>
皆様お疲れ様です。
上記の
function myStop1(){
if (myStopFlg1 == -1){
myRnd = Math.floor(Math.random()*myImageCnt);
document.myFormImg1.src = myBuffer[1].src;
myStopFlg1 = myRnd;
}
部分の myBuffer[1].src; の数値を
別窓の入力フォームより入力した数値に置き換えるコンパネのようなものを
作成したいのですが、僕の知識ではわかりませんでした。
どなたかご教授いただけませんでしょうか?
|
|