/
sample4.html
72 lines (67 loc) · 2.77 KB
/
sample4.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css">
<style>
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
/* add padding to account for vertical scrollbar */
padding-right: 20px;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
*/
* html .ui-autocomplete {
height: 100px;
}
</style>
</head>
<body>
<h1>jQuery UI Autocomplete sample 4(2つの検索フィールド)</h1>
<div class="sample">
<div class="ui-widget">
<form method="GET">
<label for="bank_code">銀行コード: </label>
<input type="text" id="bank_code" style="width:300px" name="code">
<br><br>
<label for="bank_name">銀行名: </label>
<input type="text" id="bank_name" style="width:300px" name="name">
<br><br>
<input type="submit">
</form>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
var banks = [
{value: "0001:みずほ銀行", code:"0001", name:"みずほ銀行"},
{value: "0005:三菱東京UFJ銀行", code:"0005", name:"三菱東京UFJ銀行"},
{value: "0009:三井住友銀行", code:"0009", name:"三井住友銀行"},
{value: "0016:みずほコーポレート銀行", code:"0016", name:"みずほコーポレート銀行"},
{value: "0033:ジャパンネット銀行", code:"0033", name:"ジャパンネット銀行"},
{value: "0034:セブン銀行", code:"0034", name:"セブン銀行"},
{value: "0035:ソニー銀行", code:"0035", name:"ソニー銀行"},
{value: "9900:ゆうちょ銀行", code:"9900", name:"ゆうちょ銀行"}];
var opts = {source: banks,
focus: function(event, ui){
$('#bank_code').val(ui.item.code);
$('#bank_name').val(ui.item.name);
return false;
},
select: function(event, ui){
$('#bank_code').val(ui.item.code);
$('#bank_name').val(ui.item.name);
return false;
}};
$("#bank_code").autocomplete(opts).autocomplete('option', 'minLength', 0);
$("#bank_name").autocomplete(opts).autocomplete('option', 'minLength', 0);
});
</script>
</body>
</html>