下面是一个java文本框自动补全的例子
<font face="宋体"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css"></link> <script type="text/javascript" src="jquery.autocomplete.js"></script> <style type="text/css"> body { margin: 0px; background: #f4f4f4; font-family: Helvetica Neue, Helvetica, Arial; } </style> <script type="text/javascript"> function change(){ $('#down').AutoComplete({ 'data': ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve'], 'itemHeight': 20, 'width': 280 }).AutoComplete('show'); } </script> <font face="宋体"></font> </head> <body> <div style="display:table-cell;"> <div style="height:503px;width:330px;"> <input type="text" id="down" onChange="change()"></input><span style="font-weight:bold;font-size:13px;">补全列表在下方</span> </div> </div> </body> </html> </font>
?
?