如果你想为搜索查询创建一个单行文本框,可以使用HTML5为此提供的一个专用输入控件
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div>TODO write content</div> <form action="http://www.example.org/search.php"> <p>搜索:</p> <input type="search" name="search" /> <input type="submit" value="Search" /> </form> </body> </html>