Prototype - Form.Element select() 方法
此方法选择文本输入中的当前文本。
语法
formElement.select();
返回值
它返回选定的 HTML 元素。
示例
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function showResult() { var elem = $('searchbox'); Form.Element.select(elem) } </script> </head> <body> <p>Enter some value 单击按钮查看结果。</p> <br /> <form id = "example" action = "#"> <fieldset> <div> <label for = "searchbox">Search</label> <input id = "searchbox" name = "searchbox" type = "text"> </div> <div> <input value = "Result" type = "button" onclick = "showResult();"> </div> </fieldset> </form> </body> </html>
输出
prototype_form_management.html