假如随机一个1000以内的三位数,如果是二位数则变为0xx,如果是一位数则变为00x
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math </title>
<script type="text/javascript">
function MATH(){
var num=Math.round(Math.random()*999);
document.getElementById("text1").value = num;
}
</script>
</head>
<body>
<from>
<input type="text" name="text" id="text1">
<input type="button" name="button" value="刷新" onclick="MATH()">
</from>
</body>
</html>