运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> <input type="checkbox" id="myCheck" name="vehicle" value="Bike" checked> I have a bike<br> <input type="submit" value="Submit"> </form> <p>Submit the form to see the value of the name and value attribute of the checkbox, as received input (the checkbox must be checked, or nothing is returned).</p> <p>Click the "Try it" button to change the value from "Bike" to "newCheckboxValue".</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myCheck").value = "newCheckboxValue"; document.getElementById("demo").innerHTML = "The value of the value attribute was changed. Try to submit the form again."; } </script> </body> </html>