Hi
I defined some HTML and javascript codes for my chronoform.
HTLM :
Javascript :
In fact I wish to run a function when a value is selected in the dropdownlist (id="TO"). But the function is never called. I added a smal "alert" on the begin o my function for debug purposes, I never get the alert. I get it if I put it in the "onchange" property of the dropdownlist.
Did I miss something ? Firebug says .. nothing.
Loko
I defined some HTML and javascript codes for my chronoform.
HTLM :
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td>Je souhaite contacter</td>
<td> </td>
<td><select name="TO" id="TO" onChange="Change_Type_Msg()">
<option value="arnaudgeslin@yahoo.fr" selected="selected">Le président de l'OMS</option>
<option value="arnaudgeslin@yahoo.fr">L'administrateur du site</option>
</select></td>
</tr>
<tr>
<td>pour</td>
<td> </td>
<td><select name="type" id="type">
<option selected="selected"></option>
</select></td>
</tr>
<tr>
<td>Mon Nom *</td>
<td> </td>
<td><input name="nom" id="nom" size="30" type="text" title="Nom obligatoire" /></td>
</tr>
<tr>
<td>Mon adresse mèl *</td>
<td> </td>
<td><input name="mail" id="mail" size="30" type="text" title="Adresse mèl obligatoire" /></td>
</tr>
<tr>
<td valign="top">Mon message *</td>
<td> </td>
<td><textarea name="message" id="message" rows="3" cols="80" title="Message obligatoire"></textarea></td>
</tr>
</table>
<input type="Submit" value="Envoyer">
Javascript :
function Change_Type_Msg() {
alert('a');
document.getElementById('type').options.length = 0;
if (document.getElementById('TO').options[0].selected) {
// Président
document.getElementById('type').options[0]=new Option('une question générale sur l\'OMS','Question sur l\'OMS', true);
document.getElementById('type').options[1]=new Option('une question sur un évènement ou une association en particulier','Question sur un évènement ou une association en particulier', true);
document.getElementById('type').options[2]=new Option('une autre question','Question diverse', true);
}
}
if (document.getElementById('TO').options[1].selected) {
// Webmestre
document.getElementById('type').options[0]=new Option('signaler un probléme technique','Problè technique sur le site', true);
document.getElementById('type').options[1]=new Option('faire une remarque ou une suggestion sur le contenu du site','Suggestion ou remarque sur le contenu du site', true);
document.getElementById('type').options[2]=new Option('une autre question','Question diverse', true);
}
}
}
In fact I wish to run a function when a value is selected in the dropdownlist (id="TO"). But the function is never called. I added a smal "alert" on the begin o my function for debug purposes, I never get the alert. I get it if I put it in the "onchange" property of the dropdownlist.
Did I miss something ? Firebug says .. nothing.
Loko