运行 ❯
获取你
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <p>Click the button to create an OUTPUT element.</p> <form id="myForm" oninput="x.value=parseInt(a.value)+parseInt(b.value)">0 <input type="range" id="a" value="50">100 +<input type="number" id="b" value="50">= </form> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.createElement("OUTPUT"); x.setAttribute("name", "x"); x.setAttribute("for", "a b"); document.getElementById("myForm").appendChild(x); document.getElementById("demo").innerHTML = "The output element was created. Change the value of the range or number field to see the result of a calculation."; } </script> </body> </html>