gpt4 book ai didi

javascript - 我想创建一个简单的输入框,然后在您键入时计算 80%,但不使用表单

转载 作者:行者123 更新时间:2023-11-28 14:02:19 25 4
gpt4 key购买 nike

如果我不使用表单,我不知道如何从输入框中获取值...
所以我想复制以下内容但不使用表单标签...

<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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com