Bonsoir à tous;
J'ai un script qui me permet de changer la couleur du texte dans la DIV Id= edit;
si j'ai plusieurs DIV comment puis je faire ????????????
j'ai essayé avec getElementsByTagName, avec un imput ayant pour valeur par exemple getElementById('test') pour ensuite le récupérer pour execommand mais rien ne fonctionne.
je m'y prends certainement trés mal.
Un petit de main serait trés sympas
la base :
<html><head><title></title><script>
function initial()
{Fen=window.document.getElementById('edit');
Champ=Fen.document;
Champ.designMode='On';
Fen.focus();}
</script>
</head>
<body onload="initial();" >
<input type=button value=police OnClick="colorpalette.style.visibility='visible'">
<br>
<div contenteditable="true" id="edit" style="position:relative;top:50; height:200px; width:100%; background-color:white; font-face:Impact; padding:1; border:1px solid black; scrollbar-base-color:powderblue; overflow=auto; zoom=100%;" class="liste">ttttttttttttttt</div>
<div id="colorpalette" style="visibility:hidden; position: absolute;background-color:blue; left: 400px; top: 3px;">
<table cellpadding="1" cellspacing="1" border="0" align="center">
<tr>
<td id="#800000" bgcolor="#800000" width="10" height="10" onMouseOver="this.style.border='2px dotted white';" onMouseOut="this.style.border='0px solid gray';"onClick="edit.focus();Champ.execCommand('forecolor','false','#800000'); colorpalette.style.visibility='hidden'"></td>
<td id="#FF0000" bgcolor="#FF0000" width="10" height="10"onMouseOver="this.style.border='2px dotted white';" onMouseOut="this.style.border='0px solid gray';"onClick="edit.focus();Champ.execCommand('forecolor','false','#FF0000'); colorpalette.style.visibility='hidden'"></td>
<td id="#000000" bgcolor="#000000" width="10" height="10"onMouseOver="this.style.border='2px dotted white';" onMouseOut="this.style.border='0px solid gray';"onClick="edit.focus();Champ.execCommand('forecolor','false','#000000'); colorpalette.style.visibility='hidden'"></td>
</tr>
</table>
</div>
MERCI

