promotion image of download ymail app
Promoted

怎麼用vbscript寫拉Bar遊戲的程式啊?

怎麼用vbscript寫拉Bar遊戲的程式啊?設計3個表格當做圖案(o.x.ˇ)的顯示跟一個拉bar的按鈕.

Update:

當按到3個圖示一樣時用msgbox顯示中獎

3 Answers

Rating
  • ?
    Lv 6
    1 decade ago
    Favorite Answer

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=big5">

    <title>拉Bar遊戲</title>

    </head>

    <body>

    <script language="VBScript">

    dim myloop

    Sub Cmd_Start_onClick()

    Call Run()

    End Sub

    Sub Run()

    dim myStr(3)

    myStr(1) = "O"

    myStr(2) = "X"

    myStr(3) = "√ "

    For i = 1 To 3

    Randomize

    R = Int(Rnd * 3) + 1

    document.frm.elements("Bar" & i).value = myStr(R)

    Next

    myloop = setTimeout("Run()",1)

    End Sub

    Sub Cmd_Stop_onClick()

    clearTimeout(myloop)

    TempStr = ""

    For i = 1 To 3

    TempStr = TempStr & document.frm.elements("Bar" & i).value

    Next

    If TempStr = "OOO" Or TempStr = "XXX" Or TempStr = "√√√" Then

    MsgBox "恭喜你中獎了!"

    End If

    End Sub

    </script>

    <form method="POST" name="frm">

    <p align="center">

    <input type="text" name="Bar1" size="5" readonly>

    <input type="text" name="Bar2" size="5" readonly>

    <input type="text" name="Bar3" size="5" readonly></p>

    <p align="center"><input type="button" value="啟動" name="Cmd_Start"><input type="button" value="停止" name="Cmd_Stop"></p>

    </form>

    </body>

    </html>

    • Commenter avatarLogin to reply the answers
  • 1 decade ago

    因為myStr(3) = "√ "←多了個空白改成myStr(3) = "√"就ok啦^_^

    • Commenter avatarLogin to reply the answers
  • 1 decade ago

    為啥我按到 "√√√" 卻沒顯示 "恭喜你中獎了!" ????

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.