<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" name="b" value="50" /> +
<input type="number" name="a" value="10" /> =
<output name="result">60</output>
<br>
<button type="reset">Reset</button>
</form>
更改input
的值,然后按重置按钮。在Firefox中,表单重设会将output
的值设置为空字符串,而不是其默认值。似乎Firefox无法理解HTMLOutputElement.defaultValue
:
console.log(document.getElementById('output').defaultValue);
<output id="output">60</output>
这是一个错误吗?