js右侧浮动层(随上下滚动)
js右侧浮动层(随上下滚动)
Code:
Code:
Code
1<script type="text/javascript">
2 var Choose={
3 tip : null,
4 top : 10,
5 old : 10,
6 min : false,
7 init : function() {
8 this.tip = document.getElementById('choosediv');
9 this.moveTip();
10 },
11 moveTip : function() {
12 var time=10;
13 var pos;
14 if (window.innerHeight)
15 pos = window.pageYOffset
16 else if (document.documentElement && document.documentElement.scrollTop)
17 pos = document.documentElement.scrollTop
18 else if (document.body)
19 pos = document.body.scrollTop;
20 pos=pos-Choose.tip.offsetTop+Choose.top;
21 pos=Choose.tip.offsetTop+pos/10;
22 if (pos < Choose.top)
23 pos = Choose.top;
24 if (pos != Choose.old)
25 Choose.tip.style.top = pos+"px";
26 Choose.old = pos;
27 setTimeout(Choose.moveTip,time);
28 },
29 resize : function(obj) {
30 var tb=document.getElementById("cotb");
31 var rows=tb.rows.length;
32 if(this.min){
33 obj.src='http://localhost:8080/cys2/image/sortmap02_unaction.gif';
34 obj.title='最小化';
35 this.min=false;
36 }
37 else{
38 obj.src='http://localhost:8080/cys2/image/sortmap03_action.gif';
39 obj.title='最大化';
40 this.min=true;
41 }
42 if(rows>2){
43 var show=this.min?'none':'block';
44 for (var i = 1; i <rows; i++)
45 tb.rows[i].style.display=show;
46 }
47 },
48 close : function() {
49 document.getElementById("choosediv").style.display='none';
50 }
51 };
52</script>
53<style type="text/css">
54
55</style>
56<style type="text/css">
57 body{}{margin:0;padding:0}
58 #choosediv{}{z-index: 9999;position: absolute; top: 10px;width:100%;border:red 0px solid;padding:0;margin:0}
59 #choosediv div{}{width:200px;border:red 1px solid;background-color: #FFF}
60 #choosediv table{}{width:200px;font-size:13px}
61 #choosediv td{}{padding:5px}
62 #cotitle td{}{padding:0px 5px;height:30px;border-bottom:red 1px solid;font-weight:bold;background-image: url(shttp://localhost:8080/cys2/image/smap01.gif)}
63 #cotitle img{}{margin:4px 0 0 2px;cursor:pointer}
64 .clear{}{text-align:right;padding-right:7px}
65 #choosediv th{}{text-align:left;padding-left:7px;font-weight:normal}
66 .clearall{}{text-align:right;border-top:red 1px solid;height:30px}
67</style>
68
69
70<div id='choosediv' align='right'>
71 <div>
72 <table id='cotb' border='0' cellpadding='0' cellspacing='0'>
73 <tr id='cotitle'>
74 <td>您选中对比的资源</td>
75 <td align="right">
76 <img onclick='Choose.resize(this)' src='http://localhost:8080/cys2/image/sortmap02_unaction.gif' width='21' height='21' title='最小化' /><img onclick='Choose.close()' src='http://localhost:8080/cys2/image/sortmap04_action.gif' width='21' height='21' title='关闭' />
77 </td>
78 </tr>
79 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
80 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
81 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
82 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
83 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
84 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
85 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
86 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
87 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
88 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
89 <tr>
90 <td colspan='2' class='clearall'>
91 <a href="javascript:void(0)" onclick=''>全部清除</a>
92 <a href="javascript:void(0)" onclick=''>立即对比</a>
93 </td>
94 </tr>
95 </table>
96 </div>
97</div>
98
99
100<script language="JavaScript">Choose.init();</script>
101sfdsf
102sd<br>
103fds<br>
104fds<br>
105fds<b<br>r>
106f<br>
107ds<br>sfdsf
108sd<br>sfdsf
109sd<br>
110fds<br>
111fds<br>sfds
112fds<b<br>r>
113f<br>
114ds<br>sfdsf
115sd<br>
116fds<br>
117fds<br>
118fds<b<br>r>
119f<br>
120ds<br>sfdsf
121sd<br>
122fds<br>
123fds<br>
124fds<b<br>r>
125f<br>
126ds<br>sfdsf
127sd<br>
128fds<br>
129fds<br>
130fds<b<br>r>
131f<br>
132ds<br>sfdsf
133sd<br>
134fds<br>
135fds<br>
136fds<b<br>r>
137f<br>
138ds<br>sfdsf
139sd<br>
140fds<br>
141fds<br>
142fds<b<br>r>
143f<br>
144ds<br>
145fds<br>
146fds<br>
147fds<b<br>r>
148f<br>
149ds<br>sfdsf
150sd<br>
151fds<br>
152fds<br>
153fds<b<br>r>
154f<br>
155ds<br>sfdsf
156sd<br>
157fds<br>
158fds<br>
159fds<b<br>r>
160f<br>
161ds<br>sfdsf
162sd<br>
163fds<br>
164fds<br>
165fds<b<br>r>
166f<br>
167ds<br>
/Files/sunjun/choose.rar
1<script type="text/javascript">
2 var Choose={
3 tip : null,
4 top : 10,
5 old : 10,
6 min : false,
7 init : function() {
8 this.tip = document.getElementById('choosediv');
9 this.moveTip();
10 },
11 moveTip : function() {
12 var time=10;
13 var pos;
14 if (window.innerHeight)
15 pos = window.pageYOffset
16 else if (document.documentElement && document.documentElement.scrollTop)
17 pos = document.documentElement.scrollTop
18 else if (document.body)
19 pos = document.body.scrollTop;
20 pos=pos-Choose.tip.offsetTop+Choose.top;
21 pos=Choose.tip.offsetTop+pos/10;
22 if (pos < Choose.top)
23 pos = Choose.top;
24 if (pos != Choose.old)
25 Choose.tip.style.top = pos+"px";
26 Choose.old = pos;
27 setTimeout(Choose.moveTip,time);
28 },
29 resize : function(obj) {
30 var tb=document.getElementById("cotb");
31 var rows=tb.rows.length;
32 if(this.min){
33 obj.src='http://localhost:8080/cys2/image/sortmap02_unaction.gif';
34 obj.title='最小化';
35 this.min=false;
36 }
37 else{
38 obj.src='http://localhost:8080/cys2/image/sortmap03_action.gif';
39 obj.title='最大化';
40 this.min=true;
41 }
42 if(rows>2){
43 var show=this.min?'none':'block';
44 for (var i = 1; i <rows; i++)
45 tb.rows[i].style.display=show;
46 }
47 },
48 close : function() {
49 document.getElementById("choosediv").style.display='none';
50 }
51 };
52</script>
53<style type="text/css">
54
55</style>
56<style type="text/css">
57 body{}{margin:0;padding:0}
58 #choosediv{}{z-index: 9999;position: absolute; top: 10px;width:100%;border:red 0px solid;padding:0;margin:0}
59 #choosediv div{}{width:200px;border:red 1px solid;background-color: #FFF}
60 #choosediv table{}{width:200px;font-size:13px}
61 #choosediv td{}{padding:5px}
62 #cotitle td{}{padding:0px 5px;height:30px;border-bottom:red 1px solid;font-weight:bold;background-image: url(shttp://localhost:8080/cys2/image/smap01.gif)}
63 #cotitle img{}{margin:4px 0 0 2px;cursor:pointer}
64 .clear{}{text-align:right;padding-right:7px}
65 #choosediv th{}{text-align:left;padding-left:7px;font-weight:normal}
66 .clearall{}{text-align:right;border-top:red 1px solid;height:30px}
67</style>
68
69
70<div id='choosediv' align='right'>
71 <div>
72 <table id='cotb' border='0' cellpadding='0' cellspacing='0'>
73 <tr id='cotitle'>
74 <td>您选中对比的资源</td>
75 <td align="right">
76 <img onclick='Choose.resize(this)' src='http://localhost:8080/cys2/image/sortmap02_unaction.gif' width='21' height='21' title='最小化' /><img onclick='Choose.close()' src='http://localhost:8080/cys2/image/sortmap04_action.gif' width='21' height='21' title='关闭' />
77 </td>
78 </tr>
79 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
80 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
81 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
82 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
83 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
84 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
85 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
86 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
87 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
88 <tr><th>河婆茶</th><td class='clear'><a href="javascript:void(0)" onclick=''>清除</a></td></tr>
89 <tr>
90 <td colspan='2' class='clearall'>
91 <a href="javascript:void(0)" onclick=''>全部清除</a>
92 <a href="javascript:void(0)" onclick=''>立即对比</a>
93 </td>
94 </tr>
95 </table>
96 </div>
97</div>
98
99
100<script language="JavaScript">Choose.init();</script>
101sfdsf
102sd<br>
103fds<br>
104fds<br>
105fds<b<br>r>
106f<br>
107ds<br>sfdsf
108sd<br>sfdsf
109sd<br>
110fds<br>
111fds<br>sfds
112fds<b<br>r>
113f<br>
114ds<br>sfdsf
115sd<br>
116fds<br>
117fds<br>
118fds<b<br>r>
119f<br>
120ds<br>sfdsf
121sd<br>
122fds<br>
123fds<br>
124fds<b<br>r>
125f<br>
126ds<br>sfdsf
127sd<br>
128fds<br>
129fds<br>
130fds<b<br>r>
131f<br>
132ds<br>sfdsf
133sd<br>
134fds<br>
135fds<br>
136fds<b<br>r>
137f<br>
138ds<br>sfdsf
139sd<br>
140fds<br>
141fds<br>
142fds<b<br>r>
143f<br>
144ds<br>
145fds<br>
146fds<br>
147fds<b<br>r>
148f<br>
149ds<br>sfdsf
150sd<br>
151fds<br>
152fds<br>
153fds<b<br>r>
154f<br>
155ds<br>sfdsf
156sd<br>
157fds<br>
158fds<br>
159fds<b<br>r>
160f<br>
161ds<br>sfdsf
162sd<br>
163fds<br>
164fds<br>
165fds<b<br>r>
166f<br>
167ds<br>
sun