Salut.
Mon éditeur fonctionne bien sur IE6, sur Mozilla et Netscape 7.0.
Voilà le code en entier. C'est un vrai bordel, mais c'est en construction et vraiment pas optimisé.
Si tu as la moindre question, hésite pas.
//JavaScript Document
//editeur wysiwyg
//par WhiteMagus
//Aucune copie de ce code ou d'une quelconque de ses partie n'est autorisé
//éditeur créé exclusivement pour les application qu'en fait BlackNight su Flash_Nouvelle
// ça c'est pour les caluqes contenant les couleurs et les smileys.
function afficher(id, id2, id3) {
if (document.getElementById(id).style.visibility=="visible") {
document.getElementById(id).style.visibility="hidden";
}else{
document.getElementById(id).style.visibility="visible";
document.getElementById(id2).style.visibility="hidden";
document.getElementById(id3).style.visibility="hidden";
}
}
// c'est pour transmettre la valeur de la iframe à une textArea. C'est là que ça marche pas, si ça intéresse encore quelqu'un ;)
function acquerir () {
Nom = navigator.appName;
if (Nom == 'Microsoft Internet Explorer') {
iframe = window.frames['editeur'].document;
document.getElementById('editeur_contenu').value = iframe.body.innerHTML
}else{
iframe = document.getElementById('editeur').contentDocument;
document.getElementById('editeur_contenu').value = iframe.body.innerHTML
}
}
//on rend l'iframe éditable. dans le html, on a <body onLoad="initialisation()">
// on met aussi le texte à un format prédéfini...
// scusez, c'est pas très présentable, mais je suis en plein développement là...
function initialisation () {
Nom = navigator.appName;
if (Nom == 'Microsoft Internet Explorer') {
iframe = window.frames['editeur'].document;
iframe.designMode = 'On';
}else{
iframe = document.getElementById('editeur').contentDocument;
iframe.designMode = 'On';
}
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("LiveResize", false);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("LiveResize", false);
ewin.focus();
}
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("FontName", false, "Arial");
iframe.execCommand("FontSize", false, "2");
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("FontName", false, "Arial");
iframe.execCommand("FontSize", false, "2");
ewin.focus();
}
}
/* dsl, mais à partir de là, les fonctions vont beaucoup se répéter
c'était surtout pour voir si elles marchaient individuellement, j'optimiserai plus tard
*/
function changerString (action, bool, string) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand(action, bool, string);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand(action, bool, string);
ewin.focus();
}
}
function changer (action) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand(action, false, null);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand(action, false, null);
ewin.focus();
}
}
function changerPolice () {
var police = document.taille.select2.value;
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("FontName", false, police);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("FontName", false, police);
ewin.focus();
}
}
function changerTaille () {
var taille = document.taille.select3.value;
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("FontSize", false, taille);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("FontSize", false, taille);
ewin.focus();
}
}
function changerCouleur (couleurH) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("ForeColor", false, couleurH);
ewin.focus();
document.getElementById('couleurTexte').style.visibility="hidden";
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("ForeColor", false, couleurH);
ewin.focus();
document.getElementById('couleurTexte').style.visibility="hidden";
}
}
function changerFond (couleurF) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("BackColor", false, couleurF);
ewin.focus();
document.getElementById('couleurFond').style.visibility="hidden";
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("BackColor", false, couleurF);
ewin.focus();
document.getElementById('couleurFond').style.visibility="hidden";
}
}
function changerURL () {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("CreateLink", true);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("CreateLink", true);
ewin.focus();
}
}
function image (chemin) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
iframe.execCommand("InsertImage", false, chemin);
ewin.focus();
iframe.execCommand("InsertImage", false, chemin);
document.getElementById('smiley').style.visibility="hidden";
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
iframe.execCommand("InsertImage", false, chemin);
ewin.focus();
document.getElementById('smiley').style.visibility="hidden";
}
}
/* en construction, ça permet de voir si le texte a un quelconque format puis je vais
faire en sorte que les boutons prennent une paparence spéciale selon la présence du style
qu'elles représentent*/
function verifier (commandeD, objetID) {
if (Nom == 'Microsoft Internet Explorer') {
ewin = window.frames['editeur'];
iframe = ewin.document;
statut=iframe.queryCommandState(commandeD);
ewin.focus();
}else{
ewin = document.getElementById('editeur').contentWindow;
iframe = document.getElementById('editeur').contentDocument;
statut=iframe.queryCommandState(commandeD);
ewin.focus();
}
if (statut) {
}
}
J'ai pas eu le courage de tout mettre en forme... 
Bon, @+

