-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
148 lines (124 loc) · 3.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE>
<html><head>
<meta charset="utf-8">
<title>输入框关联提示</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="inputfocus.js"></script>
<style type="text/css">
*{margin:0;padding:0;}
input{
padding: 0 0 0 10px;
height: 38px;
line-height: 38px;
border: solid 1px #f1f1f1;
vertical-align: middle;
width:222px;
}
/*-----foucus inoput----------*/
.focusinput-wrap{
position:absolute;
background: #fff none repeat scroll 0 0;
border: 1px solid #ccc;
width: 222px;
}
.focusinput-wrap .focusinput-inner{
}
.focusinput-wrap .focusinput-list{
max-height: 300px;
overflow-x: hidden;
overflow-y: auto;
position: relative;
width: 222px;
padding: 0;
}
.focusinput-wrap .focusinput-list li{
display: block;
width: 100%;
height: 30px;
line-height: 30px;
float: none;
overflow: hidden;
}
.focusinput-wrap .focusinput-list li a{
background: #fff none repeat scroll 0 0;
color: #666;
display: block;
padding-left: 10px;
}
</style>
</head>
<body>
<script>
$(function () {
/*
//调用方式一: 输入固定内容 数组 过滤显示相关内容
$('input').inputFocus({
source: [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ]
});
*/
//调用方式二: 输入固定内容, 过滤 开头相关内容
var tags = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ];
$('#name1').inputFocus({
source: function( request, response ) {
var matcher = new RegExp( "^" + this._escapeRegex( request.term ), "i" );
response( $.grep( tags, function( item ){
return matcher.test( item );
}) );
}
});
/*
//调用方式三: 传入 服务路径, 动态请求api 读库显示相关内容
$('#name1').inputFocus({
source:'http://jiancai.jiaju.sina.com.cn/index.php?app=Api2015&mod=Brand&act=get_auto_brand',
dataType:'jsonp',
targetDom:'#name',
normalizeFun: function (ret) {
// array
// for Example
// [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ]
// [{lable:'label1', value:'value1'}, {lable:'label2', value:'value2'}]
var a = [];
if (ret && ret.status == 1 && ret.data) {
var data = ret.data;
if (data && data.length > 0){
return $.map( data, function( item ) {
return {
label: item.name,
value: item.id
};
});
}
a = data;
}
return a;
},
searchFun: function (val) {
this.source( { q: val }, this._response() );
}
});
*/
});
</script>
<div>
<br/><br/><br/><br/>
<center>
<p><label>姓名</label><input id="name1" type="text" name="name" /></p>
</center>
<p><label>姓名</label><input id="name" type="text" name="name" /></p>
</div>
<!--
<div id="pannel-wrap" class="focus-wrap" style="display:none;">
<div class="inner">
<ul class="list">
<li ><a id="1"href="javascript:void(0);">abcdad1a</a></li>
<li ><a id="2" href="javascript:void(0);">abcdada2</a></li>
<li ><a id="1"href="javascript:void(0);">abcdad1a</a></li>
<li ><a id="2" href="javascript:void(0);">abcdada2</a></li>
<li ><a id="1"href="javascript:void(0);">abcdad1a</a></li>
<li ><a id="2" href="javascript:void(0);">abcdada2</a></li>
</ul>
</div>
</div>
-->
</body>
</html>