the html code
<p contenteditable="true" onmouseup="setcolor();">this text</p>
and javascript code
document.execcommand('stylewithcss', false, true); document.execcommand('forecolor', false, "rgba(0,0,0,0.5)")
; dom tree becomes:
<p contenteditable="true" onmouseup="setcolor();"> <span style="color: rgba(0, 0, 0, 0.498039);">some</span> text </p>
noticed inserts span label,with style attribute,the word's color changed. should ,when want remove span label?so word's color turn default back.i've tried
document.execcommand('forecolor', false, "");
but doen't work. thank much!
Comments
Post a Comment