如果我不使用表单,我不知道如何从输入框中获取值...
所以我想复制以下内容但不使用表单标签...
<form action="#" name="myconvert">
100% of value =
<input type="text" name="percent100"
onkeyup=" document.myconvert.percent80.value = Math.round((0.8 * document.myconvert.percent100.value)*100)/100" />
so 80% = <input type="text" name="percent80" disabled />
请帮忙
最佳答案
<input type="text" name="percent100"
onkeyup=" document.getElementById('percent80').value = Math.round((0.8 * document.getElementById('percent100').value)*100)/100" />
so 80% = <input type="text" name="percent80" disabled />
关于javascript - 我想创建一个简单的输入框,然后在您键入时计算 80%,但不使用表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4277298/