在开发的时候使用Asp.net Ajax的AJaxtoolkit是很方便的,但是对于非asp.net页面就很不方便了,下面介绍一下在html/asp/php等非asp.net下调用autoComplete的webserives
HTML 页中加入
这样就可以在input上产生autoComplete效果
关键是JS引用的顺序不要错啊
文章来源:http://www.cnblogs.com/chsword/archive/2007/08/01/839437.html
HTML 页中加入
<script type="text/javascript" src="/JavaScript/MicrosoftAjaxWebForms.js"></script>
<script type="text/javascript" src="/JavaScript/Client/Common.js"></script>
<script type="text/javascript" src="/JavaScript/Client/Timer.js"></script>
<script type="text/javascript" src="/JavaScript/Client/Animations.js"></script>
<script type="text/javascript" src="/JavaScript/Client/BaseScripts.js"></script>
<script type="text/javascript" src="/JavaScript/Client/AnimationBehavior.js"></script>
<script type="text/javascript" src="/JavaScript/Client/PopupBehavior.js"></script>
<script type="text/javascript" src="/JavaScript/Client/AutoCompleteBehavior.js"></script>
<input name="Username" type="text" id="Username" autocomplete="flase" />
<script type="text/javascript">
<!--
$create(AjaxControlToolkit.AutoCompleteBehavior, {"completionInterval":400,"completionSetCount":6,"delimiterCharacters":"","id":"autoComplete1","serviceMethod":"GetCompletionList","servicePath":"/WebServices/AutoComplete.asmx"}, null, null, $get("Username"));
// -->
</script>
<script type="text/javascript" src="/JavaScript/Client/Common.js"></script>
<script type="text/javascript" src="/JavaScript/Client/Timer.js"></script>
<script type="text/javascript" src="/JavaScript/Client/Animations.js"></script>
<script type="text/javascript" src="/JavaScript/Client/BaseScripts.js"></script>
<script type="text/javascript" src="/JavaScript/Client/AnimationBehavior.js"></script>
<script type="text/javascript" src="/JavaScript/Client/PopupBehavior.js"></script>
<script type="text/javascript" src="/JavaScript/Client/AutoCompleteBehavior.js"></script>
<input name="Username" type="text" id="Username" autocomplete="flase" />
<script type="text/javascript">
<!--
$create(AjaxControlToolkit.AutoCompleteBehavior, {"completionInterval":400,"completionSetCount":6,"delimiterCharacters":"","id":"autoComplete1","serviceMethod":"GetCompletionList","servicePath":"/WebServices/AutoComplete.asmx"}, null, null, $get("Username"));
// -->
</script>
这样就可以在input上产生autoComplete效果
关键是JS引用的顺序不要错啊
文章来源:http://www.cnblogs.com/chsword/archive/2007/08/01/839437.html