webform中文本框textbox自动联想代码
winform中的textbox可以通过AutoCompleteMode和AutoCompleteSource属性来实现自动联想,不过在webform中的textbox好像没有这俩属性呀,只有一个AutoCompleteType属性,好像也实现不了,难道webform的textbox不支持么? 也查过一些资料,基本都是用js实现的,不过没找到合适的,有些也看不懂,有哪位大神能提供点好的方法么? Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.
The datasource is a simple JavaScript array, provided to the widget using the source-option.
view <!doctype html> <html lang="en"><head> <meta charset="utf-8" /> <title>jQuery UI Autocomplete - Default functionality</title> <link rel="stylesheet" href="http:-//code.jquery.-com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http-://code.jquery.-com/jquery-1.9.1.js"></script> <script src="http:-//code.jquery.-com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $( "#tags" ).autocomplete({ source: availableTags }); }); </script></head><body> <div class="ui-widget"> <label for="tags">Tags: </label> <input id="tags" /></div> </body></html>
Want to learn more about the autocomplete widget? Check out the API documentation.
|