la fonction JS:
Code PHP :
<?php
function categories()
{
var choixCategorie = document.getElementById('champ6').options[document.getElementById('champ6').selectedIndex].value;
switch(choixCategorie)
{
case "1":
document.getElementById('champ7').innerHTML = '<option value="10" id="1">Knif</option><option value="85" id="2">Glaive</option><option value="165" id="3">Long Sword</option>';
calcul();
break;
case "2":
document.getElementById('champ7').innerHTML = '<option value="200" id="1">Aventure Suite</option><option value="750" id="2">Armor</option><option value="3500" id="3">Gold Armor</option>';
calcul();
break;
case "3":
document.getElementById('champ7').innerHTML = '<option value="150" id="1">Novice Guard</option><option value="480" id="2">Guard</option><option value="2600" id="3">Gold Guard</option>';
calcul();
break;
case "4":
document.getElementById('champ7').innerHTML = '<option value="264" id="1">Novice Glove</option><option value="562" id="2">Glove</option><option value="2841" id="3">Gold Glove</option>';
calcul();
break;
case "5":
document.getElementById('champ7').innerHTML = '<option value="246" id="1">Novice Boots</option><option value="554" id="2">Boots</option><option value="2952" id="3">Gold Boots</option>';
calcul();
break;
case "6":
document.getElementById('champ7').innerHTML = '<option value="798" id="1">Angel Helmet</option><option value="3698" id="2">Gold Helmet</option>';
calcul();
break;
case "7":
document.getElementById('champ7').innerHTML = '<option value="1500" id="1">Sword Craft</option>';
calcul();
break;
case "8":
document.getElementById('champ7').innerHTML = '<option value="973" id="1">Double Straff</option>';
calcul();
break;
case "9":
document.getElementById('champ7').innerHTML = '<option value="1250" id="1">Sonic Blow</option>';
calcul();
break;
case "10":
document.getElementById('champ7').innerHTML = '<option value="1420" id="1">Fire Bolt</option>';
calcul();
break;
case "11":
document.getElementById('champ7').innerHTML = '<option value="1600" id="1">Magnum Break</option>';
calcul();
break;
case "12":
document.getElementById('champ7').innerHTML = '<option value="1035" id="1">Music of Blind</option>';
calcul();
break;
case "13":
document.getElementById('champ7').innerHTML = '<option value="0.5" id="1">Nourriture</option><option value="0.8" id="2">Fer</option><option value="0.9" id="3">Pierre</option><option value="0.7" id="4">Bois</option><option value="1" id="5">Mana</option>';
calcul();
break;
case "14":
document.getElementById('champ7').innerHTML = '<option value="7" id="1">Potion1</option><option value="10" id="2">Potion2</option><option value="17" id="3">Potion3</option>';
calcul();
break;
case "15":
document.getElementById('champ7').innerHTML = '<option value="50" id="1">Jellopy</option>';
calcul();
break;
}
}
et le code html:
Code PHP :
<?php
<select onchange="javascript:calcul();" id="champ7">
<option value="10" id="1">Knif</option>
<option value="85" id="2">Glaive</option>
<option value="165" id="3">Long Sword</option>
</select>