如何应用在自动完成时输入的鼠标 [英] how to apply mouse entered on autocomplete

查看:76
本文介绍了如何应用在自动完成时输入的鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript" language="javascript">
    $(function () {
        $('#<%=txtItemCode.ClientID %>').autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "WebService.asmx/GetItemCode",
                    data: "{ 'ItemCode': '" + request.term + "' }",
                    type: "POST",
                    dataType: "json",
                    contentType: "application/json;charset=utf-8",
                    success: function (result) {
                        response(result.d);
                    },
                    error: function (result) {
                        alert('There is a problem processing your request');
                    }
                });
            },
            minLength: 0
        focus: function (event, ui) {
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                data: "{ Iid: '" + $('#<%=txtItemCode.ClientID %>').val() + "'}",
                url: "WebService.asmx/GetNameFromService",
                dataType: "json",
                success: function (data) {
                    $('#<%=txtKeyWord.ClientID %>').val(data.d);
                }
            });
        }
    });

</script>





我有上面的脚本,它自动完成textbox.Event应该在用户点击时引发自动完成。



我在焦点功能附近出错了我试图最大限度地摆脱那个错误它只是不工作。请帮助我。可能我错过了一个这些},}),请告诉我在哪里关闭。



I have the above script which has auto complete for textbox.Event should be raised when user clicks from the autocomplete.

I got an error near 'focus function' I tried maximum to get rid of that error its just not working.Pls help me.Probably im missing one of these },}),please tell me where to close .

推荐答案

(function(){
(function () {


('#< span class =code-pagedirective><% = txtItemCode.ClientID %> ')。autocomplete({
source:function (请求,响应){
('#<%=txtItemCode.ClientID %>').autocomplete({ source: function (request, response) {


.ajax({
url:WebService.asmx / GetItemCode,
data:{'ItemCode':'+ request.term +'},
类型:POST,
dataType:json,
contentType:application / json; charset = utf-8,
success:function(result){
response(result.d);
},
错误:函数(结果){
alert('处理您的请求时出现问题');
}
});
},
minLength:0
焦点:函数(event,ui){
.ajax({ url: "WebService.asmx/GetItemCode", data: "{ 'ItemCode': '" + request.term + "' }", type: "POST", dataType: "json", contentType: "application/json;charset=utf-8", success: function (result) { response(result.d); }, error: function (result) { alert('There is a problem processing your request'); } }); }, minLength: 0 focus: function (event, ui) {


这篇关于如何应用在自动完成时输入的鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆