乱数を生成する
サンプルソース
<input type="text" id="txt1" size="30"> <input type="button" value="乱数を表示する" onclick="document.all.txt1.value = Math.random()"> |
解説
Math.random()で乱数を生成します。実行結果
関連する内容
<input type="text" id="txt1" size="30"> <input type="button" value="乱数を表示する" onclick="document.all.txt1.value = Math.random()"> |