Bonjour,
j'utilise le script ci-dessous qui permet d'afficher la valeur d'une ou plusieurs checkbox dans un champ texte lorsque l'on clique dessus. Le souci c'est que dans firefox les caractères accentués ne s'affichent pas correctement.
J'espère que vous pourrez m'aider à corriger ce probème...
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Checkbox</title>
<script language="javascript" type="text/javascript">
function change(code, ch){
var champ = document.getElementById(ch);
var reg=new RegExp("[,]+", "g");
champ.value='';
for (i=1;i<4;i++){
coch = document.getElementById('coch'+i);
if (coch.checked) {
var cli = new String(coch.onclick);
var par = cli.substring(cli.indexOf('change'), cli.length).replace(/change\(/, '').replace(/'/g, '').replace(/"/g, '').split(reg);
if (champ.value!=''){
champ.value += ', ';
}
champ.value += ' '+par[0]+' ';
}
}
}
</script>
</head>
<body>
<form>
<input type="text" id="champ" name="champ" size="40" value=""><br>
<input type="checkbox" name="cocher" id="coch1" value="1" onclick="change('château', 'champ');" > Château<br>
<input type="checkbox" name="cocher" id="coch2" value="2" onclick="change('mère', 'champ');"> Mère<br>
<input type="checkbox" name="cocher" id="coch3" value="3" onclick="change('essai', 'champ');"> Essai
</form>
</body>
</html>
Configuration: Windows XP
Firefox 2.0.0.11