Script.aculo.us开发系列(六):AutoComplete控件
2010-09-14 13:38:34 来源:WEB开发网典型实例AutoComplete.html
<scripttype="text/javascript"src="lib/prototype.js"></script>
<scripttype="text/javascript"src="lib/scriptaculous.js?load=effects,controls"></script>
<scripttype="text/javascript">
functioninit()
{
newAjax.Autocompleter("txtSource","choices","AutoSuggest.asp",
{
paramName:'ssssssssss',
indicator:'indicator',
minChars:2,
tokens:[''],//也可以为''
frequency:0.1,
afterUpdateElement:handleAfterUpdateElement
}
);
}
Event.observe(window,'load',init);
functionhandleAfterUpdateElement(element,selectedElement)
{
//elementistheinput#txtSource
//selectedElementistheitemyouSelected,hereisli.selected
}
</script>
<styletype="text/css">
/*提示框的样式*/
#choices,input{border:solid1px#000000;width:300px;}
/*提示框下的ul标签样式*/
#choicesul{list-style-type:none;padding:0px;margin:0px;background-color:#FFFFFF;}
/*提示框下的ul标签下的li样式*/
#choicesulli{padding:2px;}
/*鼠标划过的li的样式*/
#choicesulli.selected{background-color:#f8f8f8;}
</style>
</head>
<body>
<h2>AutuCompleteusingScript.Aculo.Us</h2>
<div>
<!--txtSource为用户输入文本框-->
<inputid="txtSource"name="source"type="text"/>
<!--ajax请求时显示,请求完时隐藏-->
<spanid="indicator">
<imgsrc=http://tech.ddvip.com/2009-02/"Images/loading.gif"style="display:none;"/>
</span>
<inputtype="submit"name="button"id="button"value="提交"style="width:100px;"/>
<!--选择提示框 -->
<divid="choices"></div>
</div>
- ››Script.Aculo.Us开发系列(一):起步
- ››Script.aculo.us开发系列(二):EffectsAPI
- ››Script.aculo.us开发系列(三):核心效果(CoreEffec...
- ››Script.aculo.us开发系列(四):动画弹出菜单的实现...
- ››Script.aculo.us开发系列(五):Prototype封装的艺术...
- ››Script.aculo.us开发系列(六):AutoComplete控件
- ››Script.aculo.us开发系列(七):InPlaceEditor控件的...
- ››Script.aculo.us开发系列(八):使用DropDrag定义拖...
- ››Script.aculo.us开发系列(九):Slider控件的使用
- ››userinit.exe出现异常之解决方案
- ››Using The Silverlight DataGrid
- ››USBDeview 查询USB设备连接记录
更多精彩
赞助商链接