运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> Search: <input type="search" id="mySearch" maxlength="30"> <p>Click the button to display the value of the maxlength attribute of the search field.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("mySearch").maxLength; document.getElementById("demo").innerHTML=x; } </script> </body> </html>