不管我怎么修改代码,我总是收到一个错误。我已经写了几种不同的方式,但这里是一种方式。
我收到的错误是‘在id为’result‘的div中找不到发货费用’‘
UI约束:文件名应为index.html。计算运费使用(总运费charge=重量*成本)。有关详细规格,请参阅示例截图。
The code is suppose to look similar to
<!DOCTYPE html>
<html>
<head>
<style>
#header {
border: 1px solid lightgrey;
margin : -8px -8px 0;
background-color: lightgrey;
}
</style>
</head>
<body>
<div id="header">
<table style="width:100%">
<tr style="width:100%">
<td style="width:20%">
<span>
<img align="left" src="logo.jpeg" width="120px" height="120px">
</span>
</td>
<td style="width: 60%;">
<span>
<center>
<h1>DATAX Shipping Company</h1>
</center>
</span>
</td>
<td style="width: 40%; padding-bottom: 7%;padding-left:5%;">
<span>
<a href="#" id="signup">Sign up</a>
<a href="#" id="login" style="padding-left:30px">Log in</a>
</span>
</td>
</tr>
</table>
<!-- fill code here -->
<center>
<h3>Calculation of Shipping charge</h3>
</center>
<form>
Total Product Weight <input type="text" id="weight" /><br>
Shipping cost (per kg) <input type="text" id="cost" /><br>
<input type="button" onClick="multiplyBy()" Value="Compute" id="compute" />
</form>
The Total Shipment charge is <div id="result"></div>
<script>
function multiplyBy()
{
num1 = document.getElementById("weight").value;
num2 = document.getElementById("cost").value;
document.getElementById("result").innerText = num1 * num2;
}
</script>
</body>
</html>https://stackoverflow.com/questions/51621664
复制相似问题