アプリ版:「スタンプのみでお礼する」機能のリリースについて

<html>
<head>
<title>サンプルプログラムI</title>
<STYLE TYPE="text/css">
<!--
Body{
scrollber-3dlight-color:#000000;
scrollber-arrow-color:#000000;
scrollber-darkshadow-color:#ffffff;
scrollber-face-color:#ea9e00;
scrollber-highlight-color:#ffffff;
scrollber-shadow-color:#000000;
scrollber-track-color:#ffffff;
}-->
</STYLE>
</head>
<body>
<font size="5"><font color="#ff0000"><marquee scrollamount="30" truespeed direction="down" height=80" loop="10000000000000000000" onmouseover=this.stop() onmouseout=this.start() width="20">
☆<br>
★<br>
♠<br>
♣<br>
♥<br>
♦<br>
</font></font color></marquee>
<input type="button" value="回す"onClick="chuusenn()"><br>
<input type="button" value="リセット" onClick="init()"><br>
<hr size="10">
<marquee behavior="alternate" direction="up" height="50"><marquee direction="right"><strong><em>
↑の原理を利用してスロット作りたいなぁ。。。</strong></em>
</marquee></marquee>
<hr size="10">
<marquee behavior="alternate" direction="up" height="50">
まぁ、今回はこの程度で終わりです。
</marquee>
<marquee Bgcolor="#7f7f7f"><marquee behavior="alternate">
サンプルプログラムIIをお楽しみに!(次回いつになるか知んねぇケド
</marquee>
</body>
</html>


このプログラムはスロット形式なのですが、横に3つ記号が回るようにしようとしたら、どうしても縦になってしまってうまくいきません。どこにどういうタグを入れたらできますか?
あと、「ストップ」というボタンを付けたいのですが・・・

A 回答 (2件)

ANo.1 の Interest です。


動く例をここに書いてもいい、などといってしまった手前、引き下がるわけにも行かず、簡単な例を作ってみました。

ボタンを押せば動きが止まること、restartを押せば再開することまで実装・確認済みです。そろったら点数が出るような判定は入れていません。好きなように入れてください。完全オリジナルですが、著作権は主張しません。(このレベルじゃ恥ずかしくて主張できない)

ろくに設計もしてないコピペプログラムなので、お手本にはあまりして欲しくないですね(汗)
構造体やクラスが使えればもう少しましな設計になるのですが・・・
いや、いい訳です、すみません>エキスパートな方々

<html>
<head>
<title>JavaScriptによるスロットマシーン</title>
</head>
<!-- ============================================= -->

<script language="JavaScript">

var col0=new Array("A", "B", "C", "D", "E", "F" );
var col1=new Array("B", "C", "D", "E", "F" ,"A" );
var col2=new Array("C", "D", "E", "F", "A", "B" );

var col0ShiftTime = 800;
var col1ShiftTime = 600;
var col2ShiftTime = 450;

var col0TimeID;
var col1TimeID;
var col2TimeID;

function printCol0(){
document.MyForm.slot[0].value = col0[0];
document.MyForm.slot[3].value = col0[1];
document.MyForm.slot[6].value = col0[2];
}

function printCol1(){
document.MyForm.slot[1].value = col1[0];
document.MyForm.slot[4].value = col1[1];
document.MyForm.slot[7].value = col1[2];
}

function printCol2(){
document.MyForm.slot[2].value = col2[0];
document.MyForm.slot[5].value = col2[1];
document.MyForm.slot[8].value = col2[2];
}

function shiftCol0(){
var swap;

col0TimeID = setTimeout("shiftCol0()", col0ShiftTime);
printCol0();
swap = col0[0];
for(i=0; i<col0.length-1; i++){
col0[i] = col0[i+1];
}
col0[ col0.length-1 ] = swap;
}

function shiftCol1(){
var swap;

col1TimeID = setTimeout("shiftCol1()", col1ShiftTime);
printCol1();
swap = col1[0];
for(i=0; i<col1.length-1; i++){
col1[i] = col1[i+1];
}
col1[ col1.length-1 ] = swap;
}

function shiftCol2(){
var swap;

col2TimeID = setTimeout("shiftCol2()", col2ShiftTime);
printCol2();
swap = col2[0];
for(i=0; i<col2.length-1; i++){
col2[i] = col2[i+1];
}
col2[ col2.length-1 ] = swap;
}

function restart(){
col0TimeID = setTimeout("shiftCol0()", col0ShiftTime);
col1TimeID = setTimeout("shiftCol1()", col1ShiftTime);
col2TimeID = setTimeout("shiftCol2()", col2ShiftTime);
}

</script>

<body>

<script language="JavaScript">

var i, j;

document.write("<form name='MyForm'>");
for(i=0; i<3; i++){
for(j=0; j<3; j++){
document.write("<input size=1 name='slot'>");
}
document.write("<br>");
}
document.write("<input type='button' value='c0' onClick='clearTimeout(col0TimeID)'>");
document.write("<input type='button' value='c1' onClick='clearTimeout(col1TimeID)'>");
document.write("<input type='button' value='c2' onClick='clearTimeout(col2TimeID)'>");
document.write("<br>");
document.write("<input type='button' value='restart' onClick='restart()'>");
document.write("</form>");

shiftCol0();
shiftCol1();
shiftCol2();
</script>

</body>
</html>
    • good
    • 0
この回答へのお礼

なかなかおk!(評価する立ち場じゃないケド・・・)
思っていた以上に、なかなかいいと思います。短時間でできるとは・・・

お礼日時:2005/06/29 17:33

タグを入れるとかの問題以前に、JavaScriptの書き方になっていませんね。


それから、質問に関係ない記述が多すぎます。本当に質問したい部分に絞って投稿しましょう。

> 横に3つ記号が回るようにしようとしたら

記号は星が二つと、スペード、ダイヤ、ハート、クラブの6種類ですよね。
この6種類を組にして、3組ならべてそれぞれ違うスピードでまわす、ということでいいですか?

スロットマシーンとして動くプログラム例をここに書いてもいいのですが、sho-ckさんが果たして理解できるかどうか疑問です。

この回答への補足

すみません。とりあえず全部書いてしまえ!と思ったもので・・・
例をここに書いてもらえますか?

補足日時:2005/06/27 21:55
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!