Select avec deux value
Résolu/Fermé
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
-
17 sept. 2010 à 13:38
smoky184 Messages postés 123 Date d'inscription mardi 28 juillet 2009 Statut Membre Dernière intervention 22 janvier 2014 - 20 sept. 2010 à 16:59
smoky184 Messages postés 123 Date d'inscription mardi 28 juillet 2009 Statut Membre Dernière intervention 22 janvier 2014 - 20 sept. 2010 à 16:59
A voir également:
- Select avec deux value
- Deux ecran pc - Guide
- Faire deux colonnes sur word - Guide
- Nombre de jours entre deux dates excel - Guide
- Deux whatsapp sur un téléphone - Guide
- Itinéraire google map entre deux adresses - Guide
9 réponses
tompsy
Messages postés
251
Date d'inscription
mercredi 5 décembre 2007
Statut
Membre
Dernière intervention
19 décembre 2011
50
17 sept. 2010 à 13:47
17 sept. 2010 à 13:47
je comprends pas, tu utilise php ou javascript ?
tompsy
Messages postés
251
Date d'inscription
mercredi 5 décembre 2007
Statut
Membre
Dernière intervention
19 décembre 2011
50
17 sept. 2010 à 13:48
17 sept. 2010 à 13:48
et le mieux, c'est d'avoir le code ;)
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
17 sept. 2010 à 14:02
17 sept. 2010 à 14:02
oula alors ca risque d'etre long et brouillon ! je le met tout de suite mais pas entier sinon ... enfin bref je le met tout de suite
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
Modifié par smoky184 le 17/09/2010 à 14:19
Modifié par smoky184 le 17/09/2010 à 14:19
<html>
<head>
<script language="javascript">
function valeurpuissance_emb(){
document.formulaire.puissance_emb.value
=document.formulaire.att_emb.value;
}
function valeurpuissance_emb(){
document.formulaire.puissancee_emb.value
=document.formulaire.att_emb.value2;
}
</script>
</head>
<body>
<br><form name="formulaire" method="post">
<br><div width="566" height="20" align="center" style="background: url(.png); background-position: center; background-repeat: no-repeat"><b><font color="#ffffff"></font></b></div>
<div width="556" height="18" align="center" style="background: url(.png); background-position: center; background-repeat: no-repeat;"><b><font color="#000000"><?PHP . _NMMB . $user ?></font></b></div>
<br><div id="divid1" style="display:none;">
<Table border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td align="center" style="border: 1px solid silver"><b>Recherches</b></td><td align="center" style="border: 1px solid silver"><b><?PHP . _SECT . ?></b></td><td align="center" style="border: 1px solid silver"><b><?PHP . _GAIN . ?></b></td>
</tr>
<tr>
<td valign="top">
<table border="1" style="border-color: black" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Recherche ATT</td>
<td align="center">Recherche DEF</td>
</tr>
<tr>
<td width="50%" align="center"><img src="http://... .gif"></td>
<td width="50%" align="center"><img src="http://... .gif"></td>
</tr>
<tr>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<td align="center"><select name="att_emb" onclick="valeurpuissance_emb();">
<option value="15" selected> 0</option>
<option value="15" value2="51"> 1</option>
<option value="15"> 2</option>
<option value="15"> 3</option>
<option value="15"> 4</option>
<option value="16"> 5</option>
<option value="16"> 6</option>
<option value="16"> 7</option>
<option value="16"> 8</option>
<option value="17"> 9</option>
<option value="17"> 10</option>
<option value="17"> 11</option>
<option value="17"> 12</option>
<option value="18"> 13</option>
<option value="18"> 14</option>
<option value="18"> 15</option>
<option value="19"> 16</option>
<option value="19"> 17</option>
<option value="19"> 18</option>
<option value="19"> 19</option>
<option value="20"> 20</option>
</select></td>
<td align="center"> </td>
</tr>
</table>
</td>
<td valign="top">
<table border="0" style="border-color: black" cellspacing="0" cellpadding="0">
<tr>
<td colspan="1" align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver"><b>Unités</b></td>
<td colspan="4" align="center" style="border-left: 1px solid red; border-right: 1px solid red; border-top: 1px solid red">coûts</td>
<td colspan="6" align="center" style="border-left: 1px solid red; border-right: 1px solid red; border-top: 1px solid red">attributs</td>
</tr>
<tr>
<td colspan="11" align="center" style="border: 1px solid silver"><b>Soldats</b></td>
</tr>
<tr>
<td align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver">Emb</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
<td width="1" align="center" style="border-left: 1px solid red; border-right: 1px solid silver"><input type="text" name="puissance_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value="15"></td>
<td align="center" style="border-right: 1px solid silver"><input type="text" name="puissancee_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value=""></td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
</tr>
<tr>
<td align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver">Infanterie au Bouclier</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver"><input type="text" name="puissancee_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value=""></td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
</tr>
<head>
<script language="javascript">
function valeurpuissance_emb(){
document.formulaire.puissance_emb.value
=document.formulaire.att_emb.value;
}
function valeurpuissance_emb(){
document.formulaire.puissancee_emb.value
=document.formulaire.att_emb.value2;
}
</script>
</head>
<body>
<br><form name="formulaire" method="post">
<br><div width="566" height="20" align="center" style="background: url(.png); background-position: center; background-repeat: no-repeat"><b><font color="#ffffff"></font></b></div>
<div width="556" height="18" align="center" style="background: url(.png); background-position: center; background-repeat: no-repeat;"><b><font color="#000000"><?PHP . _NMMB . $user ?></font></b></div>
<br><div id="divid1" style="display:none;">
<Table border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td align="center" style="border: 1px solid silver"><b>Recherches</b></td><td align="center" style="border: 1px solid silver"><b><?PHP . _SECT . ?></b></td><td align="center" style="border: 1px solid silver"><b><?PHP . _GAIN . ?></b></td>
</tr>
<tr>
<td valign="top">
<table border="1" style="border-color: black" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Recherche ATT</td>
<td align="center">Recherche DEF</td>
</tr>
<tr>
<td width="50%" align="center"><img src="http://... .gif"></td>
<td width="50%" align="center"><img src="http://... .gif"></td>
</tr>
<tr>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr>
<td align="center"><select name="att_emb" onclick="valeurpuissance_emb();">
<option value="15" selected> 0</option>
<option value="15" value2="51"> 1</option>
<option value="15"> 2</option>
<option value="15"> 3</option>
<option value="15"> 4</option>
<option value="16"> 5</option>
<option value="16"> 6</option>
<option value="16"> 7</option>
<option value="16"> 8</option>
<option value="17"> 9</option>
<option value="17"> 10</option>
<option value="17"> 11</option>
<option value="17"> 12</option>
<option value="18"> 13</option>
<option value="18"> 14</option>
<option value="18"> 15</option>
<option value="19"> 16</option>
<option value="19"> 17</option>
<option value="19"> 18</option>
<option value="19"> 19</option>
<option value="20"> 20</option>
</select></td>
<td align="center"> </td>
</tr>
</table>
</td>
<td valign="top">
<table border="0" style="border-color: black" cellspacing="0" cellpadding="0">
<tr>
<td colspan="1" align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver"><b>Unités</b></td>
<td colspan="4" align="center" style="border-left: 1px solid red; border-right: 1px solid red; border-top: 1px solid red">coûts</td>
<td colspan="6" align="center" style="border-left: 1px solid red; border-right: 1px solid red; border-top: 1px solid red">attributs</td>
</tr>
<tr>
<td colspan="11" align="center" style="border: 1px solid silver"><b>Soldats</b></td>
</tr>
<tr>
<td align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver">Emb</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
<td width="1" align="center" style="border-left: 1px solid red; border-right: 1px solid silver"><input type="text" name="puissance_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value="15"></td>
<td align="center" style="border-right: 1px solid silver"><input type="text" name="puissancee_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value=""></td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
</tr>
<tr>
<td align="center" style="border-top: 1px solid silver; border-left: 1px solid silver;border-bottom:1px solid silver">Infanterie au Bouclier</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
<td align="center" style="border-left: 1px solid red; border-right: 1px solid silver"><input type="text" name="puissancee_emb" style="background-color: transparent; border: none; text-align: center" size="1" maxlength="3" value=""></td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid silver">1</td>
<td align="center" style="border-right: 1px solid red">1</td>
</tr>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
17 sept. 2010 à 14:19
17 sept. 2010 à 14:19
j'utilise HTML et JS dans cette page après ou j'utilise PHP MySQL dans tout le site
j'ai enlevé les infos inutiles car le reste fonctionne j'aimerais juste que quand je change le choix dans mon MDéroulant ca change deux case de mon tableau en même temps...
j'ai enlevé les infos inutiles car le reste fonctionne j'aimerais juste que quand je change le choix dans mon MDéroulant ca change deux case de mon tableau en même temps...
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
17 sept. 2010 à 20:15
17 sept. 2010 à 20:15
petit up ??
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
Modifié par smoky184 le 17/09/2010 à 21:49
Modifié par smoky184 le 17/09/2010 à 21:49
si je comprend je fais <option value="1|2"> 2</option>
après comment j'appelle mes deux valeurs ?
édit : après je peux appeler ces deux valeurs dans deux endroit diffèrent ?
après comment j'appelle mes deux valeurs ?
édit : après je peux appeler ces deux valeurs dans deux endroit diffèrent ?
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
18 sept. 2010 à 04:50
18 sept. 2010 à 04:50
Bon j'ai un peu simplifié le taf pour que ca soit plus facile a comprendre. il me faudrait ca mais avec 2 values et que les valeurs affiché au final soient différente
<html> <head> <title>Document sans titre</title> <script language="javascript"> function appendKeyword() { var c = 0; var index = document.f.kw.selectedIndex; var valp = document.f.kw.options[index].value; if (!document.f.cat1.value) {c=1;} if (!document.f.cat2.value) {c=1;} switch (c) { case 1 : document.f.cat1.value=valp; document.f.cat2.value=valp; break; case 2 : document.f.cat1.value=valp; document.f.cat2.value=valp; break; default : document.f.cat1.value=valp; document.f.cat2.value=valp; break; } } </script> </head> <body> <form method="POST" name="f"> <select name="kw" onchange="appendKeyword()"> <option value="">choix <option value="20">Resultat 1 <option value="34">Resultat 2 <option value="56">Resultat 3 </select> <input name="cat1" type="text" id="cat1"> <input name="cat2" type="text" id="cat2"> </form> </body> </html>
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
18 sept. 2010 à 22:42
18 sept. 2010 à 22:42
bon un petit up pour savoir si vous avez une idée ...
tompsy
Messages postés
251
Date d'inscription
mercredi 5 décembre 2007
Statut
Membre
Dernière intervention
19 décembre 2011
50
20 sept. 2010 à 09:34
20 sept. 2010 à 09:34
Pourquoi ne pas utiliser Jquery ?
C'est assez simple et tu pourra récupérer des valeurs d'attributs :
<select name="kw">
<option value1="" value2="">choix
<option value1="20" value2="01">Resultat 1
<option value1="34" value2="65">Resultat 2
<option value1="56" value2="10">Resultat 3
</select>
récupéreré avec :
var val1 = $(select).attr("value1");
ca doit pas être bon, mais c'est sans doute une bonne piste.
C'est assez simple et tu pourra récupérer des valeurs d'attributs :
<select name="kw">
<option value1="" value2="">choix
<option value1="20" value2="01">Resultat 1
<option value1="34" value2="65">Resultat 2
<option value1="56" value2="10">Resultat 3
</select>
récupéreré avec :
var val1 = $(select).attr("value1");
ca doit pas être bon, mais c'est sans doute une bonne piste.
smoky184
Messages postés
123
Date d'inscription
mardi 28 juillet 2009
Statut
Membre
Dernière intervention
22 janvier 2014
9
20 sept. 2010 à 16:59
20 sept. 2010 à 16:59
c'est bon j'ai trouvé comment marche le split()
function nom_de-fonction(){
valeurs = document.formulaire.mon_select.split('-');
document.formulaire.affichage1.value = valeurs[0];
document.formulaire.affichage2.value = valeurs[1];
}
et le select :
<select name="" onclick="nom_de_fonction();">
<option value="s'affiche dans le 1-s'affiche dans le 2">option 1</option>
</select>
puis
<input type="text" name="affichage1"value="">
<input type="text" name="affichage2"value="">
voila ! je clos le topic merci à tous de votre aide
function nom_de-fonction(){
valeurs = document.formulaire.mon_select.split('-');
document.formulaire.affichage1.value = valeurs[0];
document.formulaire.affichage2.value = valeurs[1];
}
et le select :
<select name="" onclick="nom_de_fonction();">
<option value="s'affiche dans le 1-s'affiche dans le 2">option 1</option>
</select>
puis
<input type="text" name="affichage1"value="">
<input type="text" name="affichage2"value="">
voila ! je clos le topic merci à tous de votre aide