67,512
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript">
function input()
{
var str=prompt("假设知道ABD;请输入A、B、D的值,中间用逗号分隔,比如:","2,3,5");
if(str){
compute(str);
}else
alert("空");
}
function compute(str){
var temp = str.split(',');
document.getElementById("A").value = temp[0];
document.getElementById("B").value = temp[1];
document.getElementById("D").value = temp[2];
document.getElementById("C").value = temp[0] * temp[1] ;
document.getElementById("E").value = temp[0] * temp[1] * temp[2];
}
</script>
<body onload= input()>
A:<input id="A" type="text">
<br>
B:<input id="B" type="text">
<br>
C:<input id="C" type="text">
<br>
D:<input id="D" type="text">
<br>
E:<input id="E" type="text">
</body>