(function ($) {
$.Completion = function (setting) {
var opts = $.extend({}, $.Completion.DefaultSetting, settings);
//width
var Completion_Width = null;
var Completion_Height = null;
var Completion_Height = null;
var Completion_Data_Url = null;
//Object
var Completion_Obj = null;
var Completion_Obj_Show = null;
var complete_obj_show = null;
var complete_obj_marginLeft = null;
var complete_obj_marginleft letion_obj_margintop = null; // object height
var complete_obj_heigh; 🎜> var Completion_Count = null;
//
var Completion_Type_obj = null;
// Content
var Completion_Value = null;
使う 使う 使う 使う 使う 使う アウト アウト アウト アウトout out out out out Out of ' into '' ' ' ‐ ‐ ‐ ‐ down through-set to to var Completion_N = 0; 🎜 > // コールバックを入力
var Completion_ClickCall = null;
// //コールバックを入力します 🎜> //バインディング イベント
Completion_Obj_AddEvent();
}
//初始化
function Init() {
Completion_Obj_Show = opts.Completion_Obj_Show;
//获取对象
Completion_Obj = opts.Completion_Obj;
//获取对象宽度
Completion_Width = Completion_Obj.width();
//获取层显示高度
Completion_Height = opts.Completion_Height;
//获取访问数据库URL
Completion_Data_Url = opts.Completion_Data_Url;
//每次查询多少条记录
Completion_Count = opts.Completion_Count;
//获取对象高度
Completion_Obj_Height = Completion_Obj.height();
//获取左边距
Completion_Obj_MarginLeft = Completion_Obj.offset().left;
//获取上边距
Completion_Obj_MarginTop = parseInt(Completion_Obj.offset().top) + parseInt(Completion_Obj_Height);
Completion_Type_obj = opts.Completion_Type_obj;
Completion_Bool = opts.Completion_Bool;
Completion_ClickCall = opts.Completion_ClickCall;
}
//给对象添加事件
function Completion_Obj_AddEvent() {
Completion_Obj.keyup(function (event) {
switch (event.keyCode) {
case 38:
break;
case 40:
break;
case 13:
Completion_ClickCall();
break;
default:
//按键事件 延迟操作
Cimpletion_Bind();
break;
}
});
Completion_Obj.keydown(function (event) {
switch (event.keyCode) {
case 13:
break;
case 38:
if (Completion_N == 0) {
Completion_N = (Completion_Obj_Show.find("li").length - 1);
} else if (Completion_N != 0) {
Completion_N = Completion_N - 1;
}
//alert(Completion_N);
Completion_Obj_Show.find("li").find("a").removeClass("Completion-guess-list-hover");
Completion_Obj_Show.find("li").eq(Completion_N).find("a").addClass("Completion-guess-list-hover");
Completion_Obj.val(Completion_Obj_Show.find("li").eq(Completion_N).find("ul").text());
break;
case 40:
if (Completion_N + 1 < Completion_Obj_Show.find("li").length) {
Completion_N = Completion_N + 1;
} else if (Completion_N + 1 == Completion_Obj_Show.find("li").length) {
Completion_N = 0;
}
Completion_Obj_Show.find("li").find("a").removeClass("Completion-guess-list-hover");
Completion_Obj.val(Completion_Obj_Show.find("li").eq(Completion_N).find("ul").text());
Completion_Obj_Show.find("li").eq(Completion_N).find("a").addClass("Completion-guess-list-hover");
break;
default:
break;
🎜> if (Completion_Bool) {
Completion_Type = Completion_Type_obj.val();
}
Completion_Value = Completion_Obj.val();
Completion_Value = Completion_Value.replace(" ", "" );
}
// verify
// verify
// commillification(obj)(obj)を使用して使用を使用して使用して使用して使用して使用して使用して使用{
if (obj == "" "|| Obj == NULL || Obj == 未定義) {
RETURN FALSE ;
url: Completion_Data_Url,
データ: { CompletionValue: Completion_Value, CompletionCount :compleate_count、completeType:complete_type}、
inpy: "post"、
datAtype: "json"、
success:function(obj){
// construct html
construction_add_html(obj) ;
letion_Obj.val(obj.find("ul").text ());
Completion_Obj_Show.hide();
}
//构造内容
function Completion_Add_Html(obj) {
var data = obj.Completion_Data;
//执行验证
Completion_Verification(data);
var ComPletion_Li = "";
if (data != null && data != undefined) {
for (var i = 0; i < data.length; i++) {
//执行验证是否为空
var dr = data[i];
Completion_Verification(dr);
var ComPletionName = dr.ComPletion_Name;
ComPletionName = ComPletionName.replace(Completion_Value.toUpperCase(), "" Completion_Value.toUpperCase() "");
CompPletion_Li = "< ;li>约" dr.ComPletion_Count "条记录" ComPletionName "
";
}
if (ComPletion_Li != "") {
var Complet ion_Html = "
})(jQuery);