Bonjour,
J'ai une table avec une scrollbar qui contient une liste de période. Chaque période peut etre sélectionnée. Je cherche à mettre à jour la propriété scrollTop sur le tbody pour afficher la période sélectionnée dans la liste. C'est à dire donner une position à ma scrollbar lors du rechargement de la page. Sous firefox ca fonctionne correctement je peux mettre à jour à la propriété par contre sur internet explorer la valeur reste à 0.
Comment puis je faire?
Merci.
Voici le code utilisé :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <div id="tableContainer" class="tableContainer"> <table class="scrollTable"> <tbody class="scrollContent" id="scroll"> ... </tbody> </table> </div> <script language="javascript"> var editPeriod=document.getElementById("selectedPeriod"); <%Integer numPeriod = ((Integer) session.getAttribute("numPeriod")); if(numPeriod==null) numPeriod=1; %> if(editPeriod!=null){ document.getElementById("scroll").scrollTop=parseInt(<%=numPeriod.intValue()-1%>,10)*editPeriod.offsetHeight; } </script>
Code:
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 div.tableContainer { clear: both; height: 119px; overflow: scroll; width: 265px; border:1px solid #CCCCCC; scrollbar-3dlight-color:#FFFFFF; scrollbar-arrow-color:990000; scrollbar-base-color:#EEEEEE; scrollbar-darkshadow-color:#222222; scrollbar-face-color:#EEEEEE; scrollbar-highlight-color:#EEEEEE; scrollbar-shadow-color:#EEEEEE; scrollbar-track-color:#CCCCCC; } div.tableContainer td {border:1px solid #CCCCCC;} html>body div.tableContainer { overflow: hidden; width: 251px; } div.tableContainer table { float: left; width: 240px; } html>body div.tableContainer table { width: 251px; white-space:nowrap; } html>body thead.fixedHeader tr { display: block } html>body tbody.scrollContent { display: block; height: 115px; overflow: scroll; }