博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sug
阅读量:7102 次
发布时间:2019-06-28

本文共 2723 字,大约阅读时间需要 9 分钟。

View Code
function Suggest(textInput, config) {    if (!(this instanceof Suggest)) {        return new Suggest(textInput, config);    }    var now = function() {        return (new Date).getTime();    };    var EMPTY = "",                SPACE = " ",                HIDDEN = "hidden",                NULL = null,                UNDEFINED,                WIN = window,                DOC = document,                BODY = document.body,                ARRAY_VALUE = "[object Array]",                EMPTY_FUNCTION = function() { },                PREFIX_CLS = EMPTY, //全局前缀,方便自定义                CLS_CONTAINER = PREFIX_CLS + "sug-list-container",                CLS_CONTENT = PREFIX_CLS + "sug-list-content",                CLS_ITEM_SELECTED = PREFIX_CLS + "sug-item-selected",                CLS_ITEM_KEY = PREFIX_CLS + "sug-item-key",                CLS_ITEM_RESULT = PREFIX_CLS + "sug-item-result",                DEFAULT_VALUE = "", //input 默认值                isIE = /\w/.test('\u0130'),                isIE6 = isIE && !window.XMLHttpRequest,                isIE9 = document.documentMode && document.documentMode === 9,                toString = Object.prototype.toString;    var timeout = false, //script 请求是否过时                timeoutID = null,                lockIE = NaN,                reqScript = '', //jsonp请求标签                latestReqScriptTime = '',                scriptDataIsOut = false,  //非ie6-8判断是否数据过期                isLocalDataSource = false, //根据config判断是否是本地数据源                selectedIndex = -1, //选中项索引                selectedItem = null, //当前选中项                taobaoURL = "http://suggest.taobao.com/sug?callback=callback&q=",                youaURL = "http://youa.baidu.com/suggest/se/s?cmd=suggest&type=kwd&max_count=10&callback=callback&keyword=",                baiduURL = "http://suggestion.baidu.com/su?p=3&cb=window.bdsug.sug",    //在键盘操作up,down时,忽略鼠标的mousemove,mousedown操作                mouseMoveFlag = true,    //config全部小写                defaultConfig = {                    queryname: 'wd',                    charset: 'gbk',                    callbackname: 'callback',                    callbackfn: 'bdsug.sug',                    resultkey: 's',                    containerwidth: 0,                    offsettop: -1,                    usecache: true,                    //string || json object                    datasource: "http://suggestion.baidu.com/su?p=3&cb=window.bdsug.sug",                    autofocus: false,                    inputdelay: inputDelay,                    updowndelay: updownDelay,                    /*是否使用外部css文件,动态添加                    *使用外部定制样式                    * 外部定制css

 github:嘿嘿

转载于:https://www.cnblogs.com/thomaswu/archive/2012/05/03/2480787.html

你可能感兴趣的文章
react 自定义 TabBar 组件
查看>>
Palindrome Pairs
查看>>
项目测试随笔
查看>>
poj3261 -- Milk Patterns
查看>>
HttpClient获取返回类型为JSON或XML的数据
查看>>
python 自动化对比返回结果
查看>>
SQLite分页语句
查看>>
cesiumjs开发实践(六) CZML
查看>>
基于FPGA的dds发生器与lcd显示参数
查看>>
php单例模式的使用场景,使用方法
查看>>
fetch请求get方式以及post提交参数为formdata类型的数据
查看>>
[学习笔记]凸优化/WQS二分/带权二分
查看>>
CentOS 下 LVS集群( 可能更新 )
查看>>
差分信号(Differential Signal)
查看>>
Aix项目_shell_rsh_01
查看>>
HDU 5726 GCD 求给定序列中与查询段相等的GCD个数
查看>>
python实训第四天
查看>>
5-4-3原则
查看>>
html图像入门
查看>>
C# Mongo Client 2.4.2创建索引
查看>>