et M!!!!... pas a tout les coups
bon ben je remove l'attribut en amont si il n'y a pas de background color
puisque apres tout le truc est simple
soit il y a pas d'atribut on vire
soit il y a attribut on garde
les attributs sont
face,size,color pour les attr html
apres il y a l'attribut style
dedans il peut y avoir textshadow et/ou background-color et c'est tout
donc a partir du moment ou je vire le texte shadow (textShadow="") et que le getattribute ("style")me donne"" il n'y a donc pas de background alors on peut virer l'attribut "style"
et voila c'est terminé bouclé yen a marre on passe au problème suivant ;)
voila la version avec ta methode qui marche a tous les coups
Code:
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
| function shadowcolor(coul, MOD) { if (selectionne_text()) {
var selection = selectionne_text();
var selectedText = selection.extractContents();
var balisefont = document.createElement("FONT");
balisefont.appendChild(selectedText);
var colhtml = balisefont.getElementsByTagName("FONT");
if (colhtml.length > 0) {
for (var i = 0; i < colhtml.length; i++) {
if (colhtml[i].className == "shado") {
colhtml[i].style.textShadow = "";
colhtml[i].removeAttribute("class");
}
if (colhtml[i].style.backgroundColor == "") {
colhtml[i].removeAttribute("style");
}
}
}
var ob_, ob_2, ob_3;
var colhtml = balisefont.getElementsByTagName("font");
var i = colhtml.length;
while (--i >= 0) {
ob_ = colhtml[i];
if (ob_.innerHTML === "") {
ob_.parentNode.removeChild(ob_);
} else if (!ob_.hasAttributes()) {
ob_3 = ob_.parentNode;
while (ob_2 = ob_.firstChild) {
ob_3.insertBefore(ob_2, ob_);
}
ob_3.removeChild(ob_);
}
}
alert(balisefont.innerHTML);
if (MOD == true) {
balisefont.className = "shado";
balisefont.style.textShadow = "0px 0px 10px " + coul;
}
selection.insertNode(balisefont);
if (balisefont.parentElement.className == "shado" && MOD == false && balisefont.parentElement.tagName != "P") {
balisefont.className = "shado";
balisefont.style.textShadow = "none";
}
} // FIN DE IF selectionne_text
alert("avec ta methode au final j'ai ceci pour son ouerHTML!!!!! : " + balisefont.outerHTML);
} //fin de fonction shado |
merci loralina
il faudra que je m'en souvienne pour l'attribut fantome