<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function ran(){
var num1=Math.floor(Math.random()*10)+1;
document.getElementById('n1').value=num1;
var num2=Math.floor(Math.random()*10)+1;
document.getElementById('n2').value=num2
document.getElementById('result').value=num1+num2;
}
</script>
</head>
<body>
<form>
<h3>随机加法</h3>
<input type="text" id="n1" size="12" disabled="disabled"/>+
<input type="text" id="n2" size="12" disabled="disabled"/>=
<input type="text" id="result" size="12" />
<input type="button" value="点我" onclick="ran()">
</form>
</body>
</html>