1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
var TE_LIST = [ "グー", "チョキ", "パー" ]; var KEKKA_LIST = [ "あいこ", "勝ち", "負け" ]; var com = 0; var timer = null; function change_te() { var e = document.getElementById("com"); com = (com + 1) % 3; e.innerHTML = TE_LIST[com]; } function pon(you) { if (timer == null) return; clearInterval(timer); timer = null; var kekka = (com - you + 3) % 3; alert(KEKKA_LIST[kekka]); } function start() { if (timer != null) return; timer = setInterval(change_te, 200); }