温度从xml中拉入。我需要在页面加载后转换此数字并替换原始数字。通过getElementsByClassName获取温度转换为摄氏温度取代原始温度
<td class="weathertemperature temperatureplus">26</td>
function convert() {
F = document.getElementsByClassName("weathertemperature").value * 9/5 + 32;
document.getElementsByClassName("weathertemperature").value = Math.round(F);
}
convert();
当我调试警报(F);我得到NaN
.textContent工作得好多了,谢谢! – user2882684