サイコロ
サイコロ
<html><head><title>javascript random</title></head>
<bpdy>
<script>
function altRan2() {
var r = Math.floor(Math.random() * 6) +1;
var message;
switch (r) {
case 1 :massage = “こんにちは”;
break;
case 2 :massage = “yahoo”;
break;
case 3 :massage = “nice”;
break;
case 4 :massage = “ハッスル”;
break;
case 5 :massage = “gogo”;
break;
case 6 :massage = “大当たり”;
break;
}
document.getElementById(“sai”).innerHTML = r + ” – ” + massage;
}
</script>
<form>
<input type=”button” value=”サイコロ” onClick=”altRan2()”>
<span id=”sai”>-</span>
</form>
</body>
</html>