Bonjour,

J'ai créé une div avec un scroll bar, et au milieu de cette div j'ai un bouton noir. Lorsque je clique sur le bouton noir, ma fenêtre javascript s'affiche correctement mais la scroll bar revient à sa position initiale. Moi je veux qu'elle reste en face du bouton noir après le clic sur le bouton noir. J'ai fais plusieurs tentative avec scrolltop et plusieurs fonctions javascript mais ça ne marche pas. Voilà mon dernier code que j'ai fait :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<HTML>
<HEAD>
<title>WebForm2</title>
<script type="text/javascript">
 
 
 
		function DisplayBox(type, position_left, position_top, size)
 
    {
 
 
 
        if(type == 'display')
 
        {
 
			document.getElementById('AlertBox_text').innerHTML = document.getElementById('AlertBox_content1').innerHTML ;
 
            document.getElementById('AlertBox').style.left = position_left;
 
            document.getElementById('AlertBox').style.top = position_top;
 
            document.getElementById('AlertBox').style.width = size;
 
            document.getElementById('AlertBox').style.display = 'block';
 
        }
 
        else if(type == 'hide')
 
        {
 
            document.getElementById('AlertBox_text').innerHTML = '&nbsp;';
 
            document.getElementById('AlertBox').style.display = 'none';
 
        }
 
 
 
    }
 
function setScrollValue(){
  var divObj = $get('divTest');
  var obj = $get('<%= HiddenField1.ClientID %>');
  if (obj) obj.value = divObj.scrollTop;
}
 
function pageLoad(){
var divObj = $get('divTest');
var obj = $get('<%= HiddenField1.ClientID %>');
if (divObj) divObj.scrollTop=obj.value;
}
</script>
<style type="text/css">
.alertBox {
 
 
 
		min-height: 10px;
 
        position: fixed;
 
        text-align: left;
 
        background-color: #4A93F9;
 
        border-top: 1px solid #4A93F9;
 
       -moz-border-radius: 10px;
 
        -webkit-border-radius: 10px;
 
        border-radius: 10px;
 
    	z-index: 2;
 
		display: none;
 
    }
 
     <!--
 
 
 
    .alertBox .close_button {
 
    	width: 100%;
 
    	margin-top: 20px;
 
    	padding-top: 10px;
 
        padding-bottom: 5px;
 
 
 
    	text-align: right;
 
    } -->
 
 
 
    #AlertBox_text {
 
    	font-family: calibri;
 
        font-size: 15px;
 
        color: #333333;
 
    }
 
#AlertBox_content1 {
 
    	display: none;
 
 
    }
 
.form1 {
 
	background:url(Capture3.png) left no-repeat;
	width:120px;
	height: 26px;
	padding: 0 0 0 0px;
	margin-left: 8px;
	cursor: pointer;
	border:0;
}
</style>
</HEAD>
<body>
<div id="AlertBox" class="alertBox">
 <div id="AlertBox_text">&nbsp;</div>
  <!--
   <div class="close_button"><input style="padding-right: 2px; padding-left: 2px" type="button" name="name_of_button" value="Fermer" onclick="DisplayBox('hide', '', '', '');"></div>
  -->
  </div>
 
<form  method="post" >
    <div id="divTest" style="position:fixed; left:0; width:500px; height:100px; top:0; border:solid 1px; overflow:scroll;"><ul>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li><input onclick="setScrollValue(this);" class="form1" name="round" type="submit" value="" /></li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li></li>
</ul>
</div>
<INPUT type="hidden" id="HiddenField1" >
</form>
 
<?
if(isset($_POST['round'])){
 
?>
<BODY onLoad="DisplayBox('display', '851px', '301px', '0px'); document.forms['pormas'].elements['writer'].focus()">
<?
                      }
?>
 
 
<div id="AlertBox_content1">
<form method="post" action="" >
<FIELDSET class="aze4" STYLE="border-radius:9px; background: grey;width:112px;height:150px">
<LEGEND  align="right" ><INPUT onclick="DisplayBox('hide', '', '', '');" class="bouton"  STYLE="  font-size:64%; padding-top:0px; padding-bottom:65px; padding-left:0px; padding-right:13px; max-width:5px; max-height:18px;" TYPE=SUBMIT VALUE="X"></LEGEND>
<TABLE align="left"  CELLSPACING="1" CELLPADDING="1" WIDTH="100%">
<br />
<tr>
 
  <TD >
<center><TEXTAREA NAME="reason" COLS=40 ROWS=4 WRAP=PHYSICAL></TEXTAREA></center>
</td></tr>
 
</table>
</form>
</div>
</body>
 
</HTML>

Merci à tous,
Bonne journée.