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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <html><head>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<style type="text/css">
<!--
.editor {font-family:tahoma}
.actionbar {background-color:#c0c0c0;border:1px solid black}
.comment {border:2px dotted red}
-->
</style>
<script>
function backcol(coul,MOD){
var range =window.getSelection().getRangeAt(0);
var mySelectionhtml =window.getSelection().getRangeAt(0).cloneContents();
var newNode = document.createElement("FONT");newNode.id="reverse"
newNode.appendChild(mySelectionhtml);
var f=newNode.getElementsByTagName("FONT")
for(var i=0;i<f.length;i++){
if(f[i].style.textShadow!=null && f[i].style.textShadow!=""){
couleur=f[i].style.textShadow.replace("0px 0px 10px ","");
f[i].style.textShadow="";
f[i].style.backgroundColor=couleur
}
}
range.deleteContents();
range.insertNode(newNode);
range.deleteContents();
range.insertNode(newNode);
document.execCommand("backcolor",true,coul);
document.getElementById("reverse").style.textShadow="0px 0px 10px " + coul;
document.execCommand("backcolor",false,null);
document.getElementById("reverse").removeAttribute("id");
document.getElementById('res').value=newNode.outerHTML;
}
</script>
</head>
<body>
<div id="comment" class="comment" contenteditable>
<p><font size="5">teste de <font style="text-shadow: 0px 0px 10px red;"><strong>te</strong></font><font style="text-shadow: 0px 0px 10px blue;"><strong><font color="red"><em>xt</em>e</font></strong></font><strong><font color="red"></font></strong> shadow</font></p>
</div>
<input type="button"value="backblue" onclick="backcol('blue',true)"/>
<input type="button" value="backgreen" onclick="backcol('green',true)"/>
<input type="button" value="backRED" onclick="backcol('red',true)"/>
<input type="button" value="backmagenta" onclick="backcol('magenta',true)"/>
</br>
<textarea id="res"rows="10" cols="100">
</textarea>
</body>
</html> |