HOME >
JavaScript サンプル集 > 乱数を生成する
|
乱数を生成する
サンプルソース
<html>
<body>
<input type="text" id="txt1" size="30">
<input type="button" value="乱数を表示する" onclick="document.all.txt1.value = Math.random()">
</body>
</html>
|
解説
Math.random()で乱数を生成します。
サンプル
関連する内容
|
スポンサードリンク
|