运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,暗色/亮色
前往 Spaces
<!DOCTYPE html> <html> <body> <form action="/action_page.php" target="_blank"> First name: <input type="text" name="fname" value="Donald"><br> Last name: <input type="text" name="lname" value="Duck"><br> <button id="myBtn" formmethod="get" type="submit">Submit</button> </form> <p>Click the two buttons below to change the formmethod of the submit button in the form above.</p> <button onclick="setGet()">GET</button> <button onclick="setPost()">POST</button> <p id="demo"></p> <script> function setGet() { document.getElementById("myBtn").formMethod = "GET"; document.getElementById("demo").innerHTML = "The formaction is now 'GET'."; } function setPost() { document.getElementById("myBtn").formMethod = "POST"; document.getElementById("demo").innerHTML = "The formaction is now 'POST'."; } </script> </body> </html>