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
| <style type="text/css">
<!--
#inputChoix{
display: none;
margin: 20px;
}
//-->
</style>
<script type="text/javascript">
function add()
{
var objListe = document.getElementById($name);
var valTxt = document.getElementById('newcat').value;
var opt = objListe.options[objListe.options.length-1];
objListe.options[objListe.options.length-1] = new Option(valTxt,valTxt, false, false);
objListe.options[objListe.options.length] = opt;
document.getElementById('newcat').value = "";
}
function clicListe(obj)
{
var choix = parseInt(obj.options[obj.selectedIndex].value)
if (choix==-1)
{
document.getElementById('inputChoix').style.display = "block";
}
else
{
document.getElementById('inputChoix').style.display = "none";
}
}
</script>
<form name="formfocus" method="post" action="" enctype="">
<select name="category1" id="category1" onChange="clicListe(this), $name=this.id">
<option selected="selected" value="0">-- Faites votre choix --</option>
<option value="1">choix 1</option>
<option value="2">choix 2</option>
<option value="3">choix 3</option>
<option value="4">choix 4</option>
<option value="-1">autre choix >></option>
</select>
<select name="category2" id="category2" onChange="clicListe(this), $name=this.id">
<option selected="selected" value="0">-- Faites votre choix --</option>
<option value="1">choix 1</option>
<option value="2">choix 2</option>
<option value="3">choix 3</option>
<option value="4">choix 4</option>
<option value="-1">autre choix >></option>
</select>
</form>
<div id="inputChoix">
<input type="text" size="15" id="newcat" />
<input type="button" onClick="add();" value="Ajouter" />
</div> |