<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="test" id="n1" value="" />
<input type="test" id="n2" value="" />
<input type="submit" id="d1" value="count" onclick="result()"/>
</body>
<script>
function result(){
var a1=document.getElementById("n1");
var a2=document.getElementById("n2");
var b1=Number(a1.value)+Number(a2.value);
var b2=Number(a1.value)-Number(a2.value);
var b3=Number(a1.value)*Number(a2.value);
var b4=Number(a1.value)%Number(a2.value);
alert("And"+b1+"\n"+"Difference"+b2+"\n"+"Product"+b3+"\n"+"Remainder"+b4)
}
</script>
</html>
时间: 2024-10-12 12:57:23