IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

activer / desactiver zones


Sujet :

JavaScript

  1. #1
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut activer / desactiver zones
    bonjour,

    voici le code de ma page :
    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
    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
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    <!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" >
    	<head>
    		<title>page test</title>
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     
    		<style type="text/css">
    body
    {
    	margin: 0;
    	padding: 5px;
    }
     
    form
    {
    	margin: 0;
    	padding: 0;
    }
     
    .divport
    {
    	float: left;
    	width: 25%;
    	min-width: 140px;
    	margin: 0;
    	padding: 0;
    }
     
    fieldset
    {
    	margin: 5px;
    	padding: 5px;
    	border-style: none;
    	border: 1px solid black;
    }
     
    #boutons
    {
    	clear: both;
    }
    		</style>
     
    		<script type="text/javascript">
    		/* <!-- */
     
    function DisablePort(Nom, CheckBox, Nom2)
    {
    	var mes_elements = document.getElementById(Nom).getElementsByTagName('input');
     
    	for(var i = 0; i <= mes_elements.length-1; i++){
    		mes_elements[i].disabled = CheckBox.checked;
    	};
     
    	mes_elements = document.getElementById(Nom).getElementsByTagName('select');
    	for(var i = 0; i <= mes_elements.length-1; i++){
    		mes_elements[i].disabled = CheckBox.checked;
    	};
     
    	if (CheckBox.checked == true){
    		document.getElementById(Nom).style.color='rgb(192,192,192)';
    	} else {
    		document.getElementById(Nom).style.color='black';
    	};
     
    	mes_elements = document.getElementById(Nom).getElementsByTagName('fieldset');
    	for(var i = 0; i <= mes_elements.length-1; i++)	{
    		if (CheckBox.checked == true){
    			mes_elements[i].style.border='1px solid rgb(192,192,192)';
    		} else {
    			mes_elements[i].style.border='1px solid black';
    		};
    	};
     
    	DisableElement(Nom2, CheckBox);
    };
     
    function DisableElement(Nom, CheckBox)
    {
    	var mes_elements = document.getElementById(Nom).getElementsByTagName('input');
     
    	for(var i = 0; i <= mes_elements.length-1; i++){
    		mes_elements[i].disabled = CheckBox.checked;
    	};
     
    	if (CheckBox.checked == true){
    		document.getElementById(Nom).style.color='rgb(192,192,192)';
    	} else {
    		document.getElementById(Nom).style.color='black';
    	};
    };
     
     
    		/* --> */
    		</script>
    	</head>
     
    	<body>
    		<noscript><p>Error : Javascript is disable</p></noscript>
     
    		<form id="Configuration">
     
    			<div class="divport">
    			<fieldset class="port">
    				<legend>Port 1</legend>
     
    				<label><input type="checkbox" name="EnbPort1" onclick="DisablePort('GLBPort1', this, 'GLOBALConf1')"/> Port Enable</label><br/>
     
    				<div id="GLBPort1">
    				<fieldset>
    					<legend>Transmission</legend>
     
    					<p>
    						<label><input type="checkbox" name="AutoMode1" onclick="DisableElement('GLOBALConf1', this)" /> Mode Auto</label>
    					</p>
     
    					<div id="GLOBALConf1">
    						<p>
    							Data Transfer Rate :<br/>
    							<label><input type="radio" name="rate1" value="0" /> 10 Mbits/s</label><br/>
    							<label><input type="radio" name="rate1" value="1" /> 100 Mbits/s</label>
    						</p>
     
    						<p>
    							Transmission Mode :<br/>
    							<label><input type="radio" name="duplex1" value="0" /> Half-Duplex</label><br/>
    							<label><input type="radio" name="duplex1" value="1" /> Full-Duplex</label>
    						</p>
    					</div>
     
    				</fieldset>
     
    				<p>
    					MDIX Control :<br/>
    					<label><input type="radio" name="MID1" value="0" /> Auto</label><br/>
    					<label><input type="radio" name="MID1" value="1" /> MDI</label><br/>
    					<label><input type="radio" name="MID1" value="2" /> MDIX</label>
    				</p>
     
    				<label><input type="checkbox" name="TAG1" /> TAG Suppress</label><br/>
    				<label><input type="checkbox" name="lock1" /> MAC Adress locking</label><br/>
     
    				<p>
    					<label>
    						Port VLAN ID :<br />
     
    						<select name="PVID1" >
    							<option value="00">00</option>
    							<option value="01">01</option>
    							<option value="02">02</option>
    							<option value="03">03</option>
    							<option value="04">04</option>
    							<option value="05">05</option>
    							<option value="06">06</option>
    							<option value="07">07</option>
    							<option value="08">08</option>
    							<option value="09">09</option>
    							<option value="10">10</option>
    							<option value="11">11</option>
    							<option value="12">12</option>
    							<option value="13">13</option>
    							<option value="14">14</option>
    							<option value="15">15</option>
    						</select>
    					</label>
    				</p>
     
    				<p>
    					Priority :<br/>
    					<label><input type="radio" name="PortPri1" value="0" /> VLAN First</label><br/>
    					<label><input type="radio" name="PortPri1" value="1" /> TOS First</label>
    				</p>
    			</div>
    			</fieldset>
    			</div>
     
     
    			<div class="divport">
    			<fieldset class="port">
    				<legend>Port 2</legend>
     
    				<label><input type="checkbox" name="EnbPort2" /> Port Enable</label><br/>
     
    				<p>
    					Priority :<br/>
    					<label><input type="radio" name="PortPri2" value="0" /> VLAN First</label><br/>
    					<label><input type="radio" name="PortPri2" value="1" /> TOS First</label>
    				</p>
     
    				<fieldset>
    					<legend>Transmission</legend>
     
    					<p>
    						<label><input type="checkbox" name="AutoMode2" onclick="DisableElement('GLOBALConf2', this)" /> Mode Auto</label>
    					</p>
     
    					<div id="GLOBALConf2">
    						<p>
    							Data Transfer Rate :<br/>
    							<label><input type="radio" name="rate2" value="0" /> 10 Mbits/s</label><br/>
    							<label><input type="radio" name="rate2" value="1" /> 100 Mbits/s</label>
    						</p>
     
    						<p>
    							Transmission Mode :<br/>
    							<label><input type="radio" name="duplex2" value="0" /> Half-Duplex</label><br/>
    							<label><input type="radio" name="duplex2" value="1" /> Full-Duplex</label>
    						</p>
    					</div>
     
    				</fieldset>
     
    				<p>
    					<label>
    						Port VLAN ID :<br />
     
    						<select name="PVID2" >
    							<option value="00">00</option>
    							<option value="01">01</option>
    							<option value="02">02</option>
    							<option value="03">03</option>
    							<option value="04">04</option>
    							<option value="05">05</option>
    							<option value="06">06</option>
    							<option value="07">07</option>
    							<option value="08">08</option>
    							<option value="09">09</option>
    							<option value="10">10</option>
    							<option value="11">11</option>
    							<option value="12">12</option>
    							<option value="13">13</option>
    							<option value="14">14</option>
    							<option value="15">15</option>
    						</select>
    					</label>
    				</p>
    			</fieldset>
    			</div>
     
    			<div class="divport">
    			<fieldset class="port">
    				<legend>Port 3</legend>
     
    				<label><input type="checkbox" name="EnbPort3" /> Port Enable</label><br/>
     
    				<p>
    					Priority :<br/>
    					<label><input type="radio" name="PortPri3" value="0" /> VLAN First</label><br/>
    					<label><input type="radio" name="PortPri3" value="1" /> TOS First</label>
    				</p>
     
    				<fieldset>
    					<legend>Transmission</legend>
     
    					<p>
    						<label><input type="checkbox" name="AutoMode3" onclick="DisableElement('GLOBALConf3', this)" /> Mode Auto</label>
    					</p>
     
    					<div id="GLOBALConf3">
    						<p>
    							Data Transfer Rate :<br/>
    							<label><input type="radio" name="rate3" value="0" /> 10 Mbits/s</label><br/>
    							<label><input type="radio" name="rate3" value="1" /> 100 Mbits/s</label>
    						</p>
     
    						<p>
    							Transmission Mode :<br/>
    							<label><input type="radio" name="duplex3" value="0" /> Half-Duplex</label><br/>
    							<label><input type="radio" name="duplex3" value="1" /> Full-Duplex</label>
    						</p>
    					</div>
     
    				</fieldset>
     
    				<p>
    					<label>
    						Port VLAN ID :<br />
     
    						<select name="PVID3" >
    							<option value="00">00</option>
    							<option value="01">01</option>
    							<option value="02">02</option>
    							<option value="03">03</option>
    							<option value="04">04</option>
    							<option value="05">05</option>
    							<option value="06">06</option>
    							<option value="07">07</option>
    							<option value="08">08</option>
    							<option value="09">09</option>
    							<option value="10">10</option>
    							<option value="11">11</option>
    							<option value="12">12</option>
    							<option value="13">13</option>
    							<option value="14">14</option>
    							<option value="15">15</option>
    						</select>
    					</label>
    				</p>
    			</fieldset>
    			</div>
     
    			<div class="divport">
    			<fieldset class="port">
    				<legend>Port 4</legend>
     
    				<label><input type="checkbox" name="EnbPort4" /> Port Enable</label><br/>
     
    				<p>
    					Priority :<br/>
    					<label><input type="radio" name="PortPri4" value="0" /> VLAN First</label><br/>
    					<label><input type="radio" name="PortPri4" value="1" /> TOS First</label>
    				</p>
     
    				<fieldset>
    					<legend>Transmission</legend>
     
    					<p>
    						<label><input type="checkbox" name="AutoMode4" onclick="DisableElement('GLOBALConf4', this)" /> Mode Auto</label><br/>
    					</p>
     
    					<div id="GLOBALConf4" >
    						<p>
    							Data Transfer Rate :<br/>
    							<label><input type="radio" name="rate4" value="0" /> 10 Mbits/s</label><br/>
    							<label><input type="radio" name="rate4" value="1" /> 100 Mbits/s</label>
    						</p>
     
    						<p>
    							Transmission Mode :<br/>
    							<label><input type="radio" name="duplex4" value="0" /> Half-Duplex</label><br/>
    							<label><input type="radio" name="duplex4" value="1" /> Full-Duplex</label>
    						</p>
    					</div>
     
    				</fieldset>
     
    				<p>
    					<label>
    						Port VLAN ID :<br />
     
    						<select name="PVID4" >
    							<option value="00">00</option>
    							<option value="01">01</option>
    							<option value="02">02</option>
    							<option value="03">03</option>
    							<option value="04">04</option>
    							<option value="05">05</option>
    							<option value="06">06</option>
    							<option value="07">07</option>
    							<option value="08">08</option>
    							<option value="09">09</option>
    							<option value="10">10</option>
    							<option value="11">11</option>
    							<option value="12">12</option>
    							<option value="13">13</option>
    							<option value="14">14</option>
    							<option value="15">15</option>
    						</select>
    					</label>
    				</p>
     
    			</fieldset>
    			</div>
    		</form>
     
    	</body>
    </html>
    => j'ai donc 4 zones (port 1, 2, 3 et 4)

    Dans la zone port 1, j'ai :
    1- la checbox "Mode Auto" qui active/desactive les deux parametres qui sont en dessous.
    2- la checkbox "Port Enable" qui desactive toute la section

    => le probleme est que lorsque je desactive la checkbox "Port Enable", je n'arrive pas à mettre à jour les elements géré par la checkbox "Mode Auto"

    COmment faire ? je pense que je ne suis parti dans la bonne direction (vous avez le droit de changer le code HTML)...

  2. #2
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    up
    personne n'a de solution ? je bloque vraimment ...

    si vous n'avez pas compris le probleme, n'hesitez pas à me demander plus de précisions...

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    130
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2004
    Messages : 130
    Points : 127
    Points
    127
    Par défaut
    => le probleme est que lorsque je desactive la checkbox "Port Enable", je n'arrive pas à mettre à jour les elements géré par la checkbox "Mode Auto"
    Qu'entends-tu par là plus précisément ?

  4. #4
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    c'est bon j'ai résolu mon problème...
    merci quand meme pour ton aide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. activer.desactiver une zone de texte
    Par miketidy dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 13/05/2008, 19h49
  2. Réponses: 9
    Dernier message: 06/07/2005, 14h52
  3. [JMenuItem] activer/desactiver
    Par rvfranck dans le forum Agents de placement/Fenêtres
    Réponses: 4
    Dernier message: 11/04/2005, 15h06
  4. les event de IBQuery pour activer,desactiver la Transaction?
    Par amad206 dans le forum Bases de données
    Réponses: 1
    Dernier message: 31/03/2005, 14h12
  5. Activer/Desactiver une connexion au réseau local
    Par Yodagobah dans le forum MFC
    Réponses: 7
    Dernier message: 05/01/2005, 17h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo