<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function gen_random(num1, num2) {
retval=Math.random();
document.myform.ans.value = (Math.floor(retval * (num2 - num1)) + eval(num1));
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<center>
<table border=1 cellpadding=4>
<form name=myform>
<tr><td bgcolor=#ffffe4 align=center>
<font color=blue>
乱数の範囲
</td></tr>
<tr><td align=center>
<input type=text name=d1 size=2 maxlength=2> 〜
<input type=text name=d2 size=4 maxlength=4>
</td></tr>
<tr><td align=center>
<input type=button name=btn1 value=乱数発生 onClick=gen_random(myform.d1.value,myform.d2.value)><br>
</td></tr>
<tr><td align=center>
乱 数:<input type=text name=ans size=4>
</td></tr>
</form>
</table>
</center>
</BODY>
</HTML>
|