Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript
JavaScript Forum programmation JavaScript. Lire : Cours JavaScript, FAQ JavaScript, Toutes les FAQ JavaScript et Sources JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 01/02/2011, 21h56   #1
Invité de passage
 
Inscription : février 2011
Messages : 9
Détails du profil
Informations forums :
Inscription : février 2011
Messages : 9
Points : 0
Points : 0
Par défaut div ouverte et onclick

Bonsoir à tous.

je ne sais pas comment faire pour laisser ma div ouverte au onclick qui est plus loin. La page se recharge automatiquement (normal, c'est ce que je lui demande) mais je ne vois pas bien comment changer cela pour que l'ensemble reste fonctionnel.
Il faudrait que je puisse glisser une condition du genre : si c'est un onclick, tu te fermes pas. Mais là je sèche. Merci d'avance de votre aide.

code js:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--cacher le div--> 
<script type="text/javascript"> 
function visibilite(thingId) 
{ 
var 
targetElement; 
targetElement = document.getElementById(thingId) ; 
if (targetElement.style.display == "none") 
{ 
targetElement.style.display = "" ; 
} 
else 
{ 
targetElement.style.display = "none" ; 
} 
} 
</script>
Code php :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$options=' 
<a href="javascript:visibilite(\'dividnumero1\');"> 
<strong>Définir les options</strong></a> 
<div id="dividnumero1" style="display:none;"> 
<p> 
<strong>Options type :</strong> 
</p> 
<form method="post" action="test_ccm.php" name="options_type_acces"> 
<br/>
				<input id="options_type_acces" type="radio" onclick="this.form.submit()" '.$checked_no.' name="options_type_acces" value="no"/> 
				<label for="options_type_acces"> Aucun accès</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_plan.' name="options_type_acces" value="plan"/> 
				<label for="options_type_acces"> Plans</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_cle.' name="options_type_acces" value="cle"/> 
				<label for="options_type_acces"> Clés</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_autre.' name="options_type_acces" value="autre"/> 
				<label for="options_type_acces"> Autre</label>	
 
//... 
</form> 
</div>
Si vous avez une piste... Merci !
Dvlop.com est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/02/2011, 22h14   #2
Rédacteur/Modérateur
 
Avatar de SpaceFrog
 
Homme
Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Inscription : mars 2002
Messages : 30 007
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Royaume-Uni

Informations professionnelles :
Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Secteur : Industrie

Informations forums :
Inscription : mars 2002
Messages : 30 007
Points : 45 091
Points : 45 091
curieuse ergonomie ...
le submit sur les clicks ...

Bref, comme tu as pu le constater qui dit submit dit rechargement de page.

trois solutions:

soit tu passes par ajax pour atteindre le serveur et ainsi éviter le rechargement de page.

soit tu gères l'affichage avec php vu que tu seras coté serveur avec tous les paramètre nécessaire (get post ou varirble de session)

soit tu repenses ton ergonomie
__________________
Ma page Developpez
Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
Votre post est résolu ? Alors n'oubliez pas le Tag


réalisations :www.planet-languages.com|www.saftair.com| www.ouestisol.fr | www.sebemex.fr | www.extramiante.fr | www.sistac-alizay.fr | www.acoustishop.fr | www.litt.fr | www.ouestventil.fr
SpaceFrog est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/02/2011, 01h05   #3
Invité de passage
 
Inscription : février 2011
Messages : 9
Détails du profil
Informations forums :
Inscription : février 2011
Messages : 9
Points : 0
Points : 0
Bonsoir SpaceFrog et merci de ta réponse.
je débute, d'où sans doute la "curieuse ergonomie". Le problème c'est que ça ne m'aiguille pas beaucoup sur le comment reprendre.
je ne connais que très peu le JS. Un peu plus le php.(mais la solution ajax m'embête un peu car je ne connais pas du tout).

Je me permets de te mettre une page dans son intégralité, afin que tu puisses m'aiguiller davantage dans ta réponse et que je puisse reprendre ce qui ne va pas.
Je mets ci suivant donc juste le module qui pose problème. A savoir : il représente 3 champs d'un gros formulaire dans lequel il est inséré grâce à du php.
Je bidouille ma page avec le css pour qu'elle soit fonctionnelle si par curiosité tu veux tester (c'est peut-être plus facile).

Merci d'avance des précisions que tu pourras apporter sur comment repenser ma curieuse ergonomie... et merci déjà de tes pistes !

test_ccm.php :

Code php :
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
 <head>
		<style>	
			#dividnumero1
			{
				width:300px;
			}
			table.tableau
			{
				width:300px;
			}
			.tableau
			{
				border:1px solid;
				border-collapse:collapse;
				text-align:center;
				padding:0px;
				margin:0px;
			}
			.tableau .titres_horiz
			{
			text-align:center;
			}
				.titres_horiz .acces
				{
				text-align:center;
				padding-top:10px;
				border:1px solid;
				}
				.titres_horiz .option
				{
				width:120px;
				text-align:center;
				padding-bottom:10px;
				padding-top:10px;
				}
			.ss_titres_horiz
			{
			text-align:center;
			border-bottom:1px solid;
			}
				.ss_titres_horiz td
				{
				width:30px;
				text-align:center;
				}
 
			.tableau .titres_verti
			{
			text-align:left;
			width:90px;
			border-right:1px solid;
			border-left:1px solid;
			}
			.tableau tr.gris
			{
			background-color:#e3e0e0;
			}
			.tableau td
			{
			border-left:1px solid #b8b7b7;
			width:30px;
			text-align:center;
			}
		</style>
		<!--cacher le div-->
		<script type="text/javascript">
			function visibilite(thingId)
				{
				var 
					targetElement;
					targetElement = document.getElementById(thingId) ;
				if (targetElement.style.display == "none")
					{
					targetElement.style.display = "" ;
					}
				else 
					{
					targetElement.style.display = "none" ;
					}
				}
		</script>
	<title>Test</title>
   </head>
<body>
 
<?php
//choix des options
$acces_en_tete='<p>';
//valeur de case précochée option type
$checked_no='';
$checked_plan='';
$checked_cle='';
$checked_autre='';
//valeur case précochée tableau
$checked_blop_no='';
$checked_bang_no='';
$checked_tim_no='';
 
$checked_blop_plan='';
$checked_bang_plan='';
$checked_tim_plan='';
 
$checked_blop_cle='';
$checked_bang_cle='';
$checked_tim_cle='';
 
	if(isset($_POST['options_type_acces']))
	{
		$options_type_acces=$_POST['options_type_acces'];
		//Personne n'a d'accès
		if($options_type_acces=='no')
		{
			$checked_no=' checked="checked" ';
			$checked_blop_no=' checked="checked" ';
			$checked_bang_no=' checked="checked" ';
			$checked_tim_no=' checked="checked" ';
		}
		//tout le monde a accès aux plans
		elseif($options_type_acces=='plan')
		{
			$checked_plan=' checked="checked" ';
			$checked_blop_plan=' checked="checked" ';
			$checked_bang_plan=' checked="checked" ';
			$checked_tim_plan=' checked="checked" ';
		}
		//tout le monde a accès aux clés
		elseif($options_type_acces=='cle')
		{
			$checked_cle=' checked="checked" ';
			$checked_blop_cle=' checked="checked" ';
			$checked_bang_cle=' checked="checked" ';
			$checked_tim_cle=' checked="checked" ';
		}
		//autres 
		elseif($options_type_acces=='autre')
		{
			$checked_autre=' checked="checked" ';
			$checked_bang_no=' checked="checked" ';
			$checked_blop_plan=' checked="checked" ';
			$checked_tim_cle=' checked="checked" ';
		}
		//(rien n'est précisé)
		else
		{
			//valeur de case précochée option type
			$checked_no='';
			$checked_plan='';
			$checked_cle='';
			$checked_autre='';
			//valeur case précochée tableau
			$checked_blop_no='';
			$checked_bang_no='';
			$checked_tim_no='';
 
			$checked_blop_plan='';
			$checked_bang_plan='';
			$checked_tim_plan='';
 
			$checked_blop_cle='';
			$checked_bang_cle='';
			$checked_tim_cle='';
		}
	}
 
//clic et si clic déplie les options sinon par déft tout à NON : pas d'accès
$options='
<a href="javascript:visibilite(\'dividnumero1\');"><strong>Définir les options</strong></a>
	<div id="dividnumero1" style="display:none;">
		<p>
		<strong>Options type :</strong>
		</p>
		<form method="post" action="test_ccm.php" name="options_type_acces">
			<br/>
				<input id="options_type_acces" type="radio" onclick="this.form.submit()" '.$checked_no.' name="options_type_acces" value="no"/> 
				<label for="options_type_acces"> Aucun accès</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_plan.' name="options_type_acces" value="plan"/> 
				<label for="options_type_acces"> Plans</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_cle.' name="options_type_acces" value="cle"/> 
				<label for="options_type_acces"> Clés</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_autre.' name="options_type_acces" value="autre"/> 
				<label for="options_type_acces"> Autre</label>					
		</form>
		<table class="tableau">
				<tr valign="top" class="titres_horiz">
					<td colspan=1 rowspan=2 class="acces">
						<strong>Accès</strong>
					</td>
					<td colspan=4 rowspan=1 class="option">
						<strong>Options</strong>
					</td>
				</tr>
				<tr class="ss_titres_horiz">
					<td colspan=1 rowspan=1>
						Aucun accès
					</td>
					<td colspan=1 rowspan=1>
						Plans
					</td>
					<td colspan=1 rowspan=1>
						Clés
					</td>
				</tr>
				<tr class="gris">
					<td colspan=1 rowspan=1 class="titres_verti">
						<label for="blop_acces">Professeur Blop</label>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces" '.$checked_blop_no.' value="NO"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces" '.$checked_blop_plan.' value="PLAN"/>
 
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces" '.$checked_blop_cle.' value="CLE"/>
					</td>
				</tr>
				<tr>
					<td colspan=1 rowspan=1 class="titres_verti">
						<label for="bang_acces">Professeur Bang</label>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces" '.$checked_bang_no.' value="NO"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces" '.$checked_bang_plan.' value="PLAN"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces" '.$checked_bang_cle.' value="CLE"/>
					</td>
				</tr>
				<tr class="gris">
					<td colspan=1 rowspan=1 class="titres_verti">
						<label for="tim_acces">Professeur Tim</label>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces" '.$checked_tim_no.' value="NO"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces" '.$checked_tim_plan.' value="PLAN"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces" '.$checked_tim_cle.' value="CLE"/>
					</td>
				</tr>	
			</table>
	</div>
';
$acces_pied='</p>';
$acces=$acces_en_tete.$options.$acces_pied;
echo $acces;
?>
Dvlop.com est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/02/2011, 08h36   #4
Rédacteur/Modérateur
 
Avatar de SpaceFrog
 
Homme
Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Inscription : mars 2002
Messages : 30 007
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Royaume-Uni

Informations professionnelles :
Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Secteur : Industrie

Informations forums :
Inscription : mars 2002
Messages : 30 007
Points : 45 091
Points : 45 091
javascript est un langage client qui gères des objets html ...
En conséquence ton code php ne nous est pas d'une grande utilité.
Merci de poster plutot le code source html généré ...
sans oublier les balises code ...
__________________
Ma page Developpez
Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
Votre post est résolu ? Alors n'oubliez pas le Tag


réalisations :www.planet-languages.com|www.saftair.com| www.ouestisol.fr | www.sebemex.fr | www.extramiante.fr | www.sistac-alizay.fr | www.acoustishop.fr | www.litt.fr | www.ouestventil.fr
SpaceFrog est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/02/2011, 12h04   #5
Invité de passage
 
Inscription : février 2011
Messages : 9
Détails du profil
Informations forums :
Inscription : février 2011
Messages : 9
Points : 0
Points : 0
Bonjour tout le monde.
(vite fait à la pause 12h du boulo...)
Spacefrog, je mets ci suivant le code html généré.
...et c'est moi qui te remercie!

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
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
 <head>
		<style>	
			#dividnumero1
			{
				width:300px;
			}
			table.tableau
			{
				width:300px;
			}
			.tableau
			{
				border:1px solid;
				border-collapse:collapse;
				text-align:center;
				padding:0px;
				margin:0px;
			}
			.tableau .titres_horiz
			{
			text-align:center;
			}
				.titres_horiz .acces
				{
				text-align:center;
				padding-top:10px;
				border:1px solid;
				}
				.titres_horiz .option
				{
				width:120px;
				text-align:center;
				padding-bottom:10px;
				padding-top:10px;
				}
			.ss_titres_horiz
			{
			text-align:center;
			border-bottom:1px solid;
			}
				.ss_titres_horiz td
				{
				width:30px;
				text-align:center;
				}
 
			.tableau .titres_verti
			{
			text-align:left;
			width:90px;
			border-right:1px solid;
			border-left:1px solid;
			}
			.tableau tr.gris
			{
			background-color:#e3e0e0;
			}
			.tableau td
			{
			border-left:1px solid #b8b7b7;
			width:30px;
			text-align:center;
			}
		</style>
		<!--cacher le div-->
		<script type="text/javascript">
			function visibilite(thingId)
				{
				var 
					targetElement;
					targetElement = document.getElementById(thingId) ;
				if (targetElement.style.display == "none")
					{
					targetElement.style.display = "" ;
					}
				else 
					{
					targetElement.style.display = "none" ;
					}
				}
		</script>
	<title>Test</title>
   </head>
 
<body>
 
<p>
<a href="javascript:visibilite('dividnumero1');"><strong>Définir les options</strong></a>
	<div id="dividnumero1" style="display:none;">
		<p>
		<strong>Options type :</strong>
		</p>
		<form method="post" action="test_ccm.php" name="options_type_acces">
			<br/>
 
				<input id="options_type_acces" type="radio" onclick="this.form.submit()"  name="options_type_acces" value="no"/> 
				<label for="options_type_acces"> Aucun accès</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()"  name="options_type_acces" value="plan"/> 
				<label for="options_type_acces"> Plans</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()"  name="options_type_acces" value="cle"/> 
				<label for="options_type_acces"> Clés</label>
 
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()"  name="options_type_acces" value="autre"/> 
				<label for="options_type_acces"> Autre</label>					
		</form>
		<table class="tableau">
				<tr valign="top" class="titres_horiz">
					<td colspan=1 rowspan=2 class="acces">
						<strong>Accès</strong>
 
					</td>
					<td colspan=4 rowspan=1 class="option">
						<strong>Options</strong>
					</td>
				</tr>
				<tr class="ss_titres_horiz">
					<td colspan=1 rowspan=1>
						Aucun accès
					</td>
 
					<td colspan=1 rowspan=1>
						Plans
					</td>
					<td colspan=1 rowspan=1>
						Clés
					</td>
				</tr>
				<tr class="gris">
					<td colspan=1 rowspan=1 class="titres_verti">
						<label for="blop_acces">Professeur Blop</label>
 
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces"  value="NO"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces"  value="PLAN"/>
 
					<td colspan=1 rowspan=1>
						<input type="radio" name="blop_acces"  value="CLE"/>
					</td>
 
				</tr>
				<tr>
					<td colspan=1 rowspan=1 class="titres_verti">
						<label for="bang_acces">Professeur Bang</label>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces"  value="NO"/>
					</td>
 
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces"  value="PLAN"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="bang_acces"  value="CLE"/>
					</td>
				</tr>
				<tr class="gris">
					<td colspan=1 rowspan=1 class="titres_verti">
 
						<label for="tim_acces">Professeur Tim</label>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces"  value="NO"/>
					</td>
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces"  value="PLAN"/>
					</td>
 
					<td colspan=1 rowspan=1>
						<input type="radio" name="tim_acces"  value="CLE"/>
					</td>
				</tr>	
			</table>
	</div>
</p>
Dvlop.com est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/02/2011, 16h54   #6
Invité de passage
 
Inscription : février 2011
Messages : 9
Détails du profil
Informations forums :
Inscription : février 2011
Messages : 9
Points : 0
Points : 0
Re...

je crois que la solution se rapproche d'un "javascript:return false;" sur le lien qui appele ma fonction JS, pour empêcher le rechargement de la page.
Mais alors les boutons radios ne sont plus précochés...
ou alors je ne suis pas fichue de l'adapter à mon pti code...
en plus peut-être que je me trompe.
pff... mal barrée donc.

Bref, de bidouillages en bidouillages, je suis parvenue avec du php, à avancer un peu, mais ça me parait bien complexe (!) pour réussir ce que je voudrais.... en plus à priori mon bidule est assez mal pensé...

Quelqu'un pourrait-il m'aiguiller un peu pour y voir plus clair ?
Merci de votre aide

A la suite, je mets mon code revu avec le php

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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
 <head>
		<style>	
			#dividnumero1
			{
				width:300px;
			}
			table.tableau
			{
				width:300px;
			}
			.tableau
			{
				border:1px solid;
				border-collapse:collapse;
				text-align:center;
				padding:0px;
				margin:0px;
			}
			.tableau .titres_horiz
			{
			text-align:center;
			}
				.titres_horiz .acces
				{
				text-align:center;
				padding-top:10px;
				border:1px solid;
				}
				.titres_horiz .option
				{
				width:120px;
				text-align:center;
				padding-bottom:10px;
				padding-top:10px;
				}
			.ss_titres_horiz
			{
			text-align:center;
			border-bottom:1px solid;
			}
				.ss_titres_horiz td
				{
				width:30px;
				text-align:center;
				}
 
			.tableau .titres_verti
			{
			text-align:left;
			width:90px;
			border-right:1px solid;
			border-left:1px solid;
			}
			.tableau tr.gris
			{
			background-color:#e3e0e0;
			}
			.tableau td
			{
			border-left:1px solid #b8b7b7;
			width:30px;
			text-align:center;
			}
		</style>
		<!--cacher le div-->
		<script type="text/javascript">
			function visibilite(thingId)
				{
				var 
					targetElement;
					targetElement = document.getElementById(thingId) ;
				if (targetElement.style.display == "none")
					{
					targetElement.style.display = "" ;
					}
				else 
					{
					targetElement.style.display = "none" ;
					}
				}
		</script>
	<title>Test</title>
   </head>
<body>
 
<?php
//choix des options
$acces_en_tete='<p>';
//valeur de case précochée option type
$checked_no='';
$checked_plan='';
$checked_cle='';
$checked_autre='';
//valeur case précochée tableau
$checked_blop_no='';
$checked_bang_no='';
$checked_tim_no='';
 
$checked_blop_plan='';
$checked_bang_plan='';
$checked_tim_plan='';
 
$checked_blop_cle='';
$checked_bang_cle='';
$checked_tim_cle='';
 
	if(isset($_POST['options_type_acces']))
	{
		$options_type_acces=$_POST['options_type_acces'];
		//Personne n'a d'accès
		if($options_type_acces=='no')
		{
			$checked_no=' checked="checked" ';
			$checked_blop_no=' checked="checked" ';
			$checked_bang_no=' checked="checked" ';
			$checked_tim_no=' checked="checked" ';
		}
		//tout le monde a accès aux plans
		elseif($options_type_acces=='plan')
		{
			$checked_plan=' checked="checked" ';
			$checked_blop_plan=' checked="checked" ';
			$checked_bang_plan=' checked="checked" ';
			$checked_tim_plan=' checked="checked" ';
		}
		//tout le monde a accès aux clés
		elseif($options_type_acces=='cle')
		{
			$checked_cle=' checked="checked" ';
			$checked_blop_cle=' checked="checked" ';
			$checked_bang_cle=' checked="checked" ';
			$checked_tim_cle=' checked="checked" ';
		}
		//autre
		elseif($options_type_acces=='autre')
		{
			$checked_autre=' checked="checked" ';
		}
		//(rien n'est précisé)
		else
		{
			//valeur de case précochée option type
			$checked_no='';
			$checked_plan='';
			$checked_cle='';
			$checked_autre='';
			//valeur case précochée tableau
			$checked_blop_no='';
			$checked_bang_no='';
			$checked_tim_no='';
 
			$checked_blop_plan='';
			$checked_bang_plan='';
			$checked_tim_plan='';
 
			$checked_blop_cle='';
			$checked_bang_cle='';
			$checked_tim_cle='';
		}  
		//TRAITEMENT DE LA CASE "AUTRE"
		if ($checked_blop_no==' checked="checked" ' && $checked_bang_no==' checked="checked" ' && $checked_tim_no==' checked="checked" ')
		{
			//no coché
			$checked_no=' checked="checked" ';
		}
		elseif ($checked_blop_plan==' checked="checked" ' && $checked_bang_plan==' checked="checked" ' && $checked_tim_plan==' checked="checked" ')
		{
			//plan coché
			$checked_plan=' checked="checked" ';
		}
		elseif ($checked_blop_cle==' checked="checked" ' && $checked_bang_cle==' checked="checked" ' && $checked_tim_cle==' checked="checked" ')
		{
			//clé coché
			$checked_cle=' checked="checked" ';
		}
		else
		{
			//Autre
			$checked_autre=' checked="checked" ';
		}
	$options='
	<p><strong>Droits d\'accès du compte : </strong></p>
	<table class="tableau">
		<tr valign="top" class="titres_horiz">
			<td colspan=1 rowspan=2 class="acces">
				<strong>Accès</strong>
			</td>
			<td colspan=4 rowspan=1 class="option">
				<strong>Options</strong>
			</td>
		</tr>
		<tr class="ss_titres_horiz">
			<td colspan=1 rowspan=1>
				Aucun accès
			</td>
			<td colspan=1 rowspan=1>
				Plans
			</td>
			<td colspan=1 rowspan=1>
				Clés
			</td>
		</tr>
		<tr class="gris">
			<td colspan=1 rowspan=1 class="titres_verti">
				<label for="blop_acces">Professeur Blop</label>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="blop_acces" '.$checked_blop_no.' value="NO"/>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="blop_acces" '.$checked_blop_plan.' value="PLAN"/>
 
			<td colspan=1 rowspan=1>
				<input type="radio" name="blop_acces" '.$checked_blop_cle.' value="CLE"/>
			</td>
		</tr>
		<tr>
			<td colspan=1 rowspan=1 class="titres_verti">
				<label for="bang_acces">Professeur Bang</label>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="bang_acces" '.$checked_bang_no.' value="NO"/>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="bang_acces" '.$checked_bang_plan.' value="PLAN"/>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="bang_acces" '.$checked_bang_cle.' value="CLE"/>
			</td>
		</tr>
		<tr class="gris">
			<td colspan=1 rowspan=1 class="titres_verti">
				<label for="tim_acces">Professeur Tim</label>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="tim_acces" '.$checked_tim_no.' value="NO"/>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="tim_acces" '.$checked_tim_plan.' value="PLAN"/>
			</td>
			<td colspan=1 rowspan=1>
				<input type="radio" name="tim_acces" '.$checked_tim_cle.' value="CLE"/>
			</td>
		</tr>	
	</table>
	<p><a href="javascript:visibilite(\'dividnumero1\');"><strong>Redéfinir les accès à partir des options types</strong></a></p>
	<div id="dividnumero1" style="display:none;">
		<p>
		<strong>Options type :</strong>
		</p>
		<form method="post" action="test_ccm.php" name="options_type_acces">
			<br/>
				<input id="options_type_acces" type="radio" onclick="this.form.submit()" '.$checked_no.' name="options_type_acces" value="no"/> 
				<label for="options_type_acces"> Aucun accès</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_plan.' name="options_type_acces" value="plan"/> 
				<label for="options_type_acces"> Plans</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_cle.' name="options_type_acces" value="cle"/> 
				<label for="options_type_acces"> Clés</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_autre.' name="options_type_acces" value="autre"/> 
				<label for="options_type_acces"> Autre</label>					
		</form>
	</div>
	';
}
else
{	
//clic et si clic déplie les options
$options='
<a href="javascript:visibilite(\'dividnumero1\');"><strong>Définir les options</strong></a>
	<div id="dividnumero1" style="display:none;">
		<p>
		<strong>Options type :</strong>
		</p>
		<form method="post" action="test_ccm.php" name="options_type_acces">
			<br/>
				<input id="options_type_acces" type="radio" onclick="this.form.submit()" '.$checked_no.' name="options_type_acces" value="no"/> 
				<label for="options_type_acces"> Aucun accès</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_plan.' name="options_type_acces" value="plan"/> 
				<label for="options_type_acces"> Plans</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_cle.' name="options_type_acces" value="cle"/> 
				<label for="options_type_acces"> Clés</label>
			<br/>
				<input id="options_type_acces" type="radio"  onclick="this.form.submit()" '.$checked_autre.' name="options_type_acces" value="autre"/> 
				<label for="options_type_acces"> Autre</label>					
		</form>
	</div>
';
}
$acces_pied='</p>';
$acces=$acces_en_tete.$options.$acces_pied;
echo $acces;
?>
Dvlop.com est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h21.


 
 
 
 
Partenaires

Hébergement Web