<!DOCTYPE HTML><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8 "><title>让用户输入两个数字,然后输出相加的结果</title></head><body style="overflow:auto; padding:0px; margin:0px;"><div style="font-size:14px; font-weight:bold; color:white; font-family:Arial,宋体; background-color;#6090DA; padding:4px 10px;"><script> intA = prompt("请输入第一个数字",""); intB = prompt("请输入第二个数字",27); document.write("你输入的第一个数字是"+intA); document.write("<br>你输入的第二个数字是"+intB); document.write("<br>两者和是"+(parseInt(intA)+parseInt(intB)));</script></div></body></html>
3 回答
田心枫
TA贡献1064条经验 获得超383个赞
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8 ">
<title>让用户输入两个数字,然后输出相加的结果</title>
</head>
<body>
<script>
intA = prompt("请输入第一个数字","");
intB = prompt("请输入第二个数字",27);
console.log(intA);
document.write("你输入的第一个数字是"+intA);
document.write("<br>你输入的第二个数字是"+intB);
document.write("<br>两者和是"+(parseInt(intA)+parseInt(intB)));
</script>
</div>
</body>
</html>
添加回答
举报
0/150
提交
取消
