运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> Select a file: <input type="file" id="myFile" name="usr_file" required> <input type="submit"> </form> <p>Click the "Try it" button to find out if a file in the file upload field must be selected before submitting the form.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myFile").required; document.getElementById("demo").innerHTML = x; } </script> </body> </html>