-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest02.html
43 lines (36 loc) · 1.04 KB
/
test02.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery/jquery-1.9.1.min.js"></script>
</head>
<body>
<div class="input-txt">
<input type="text" maxlength ="3"><input type="text" maxlength ="3"><input type="text" maxlength ="3"><input type="text" maxlength ="3"><input type="text" maxlength ="3">
</div>
<style>
body{ height:1000px;}
.fixed{ width:200px; height:400px; background:#666; position:absolute; right:0; top:100px;}
</style>
<div class="fixed">
</div>
<script>
$('.input-txt input').each(function(i) {
var maxlength = $(this).attr("maxlength");
$(this).keyup(function(e) {
if($(this).val().length == maxlength && $(this).next('input').size()){
$(this).next('input').focus();
}
if(event.keyCode == 8 && $(this).val() == 0 && $(this).prev('input').size()){
$(this).prev('input').focus();
};
});
});
$(document).scroll(function(e) {
$('.fixed').css('top',function(){
});
});
</script>
</body>
</html>