Sure.The following is my code.
function font(elems,tag,size){
var i=0, el, selectedText, newText;
while(el=elems[i++]){
selectedText=document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);// IE:Moz
if(selectedText!=''){
newText='<'+tag+" size="+size+'>'+selectedText+'</'+tag+'>';
if(document.selection){//IE
document.selection.createRange().text=newText;
return;//prevents the double replacement
}
else{//Moz
el.value=el.value.substring(0,el.selectionStart)+newText+el.value.substring(el.selectionEnd,el.value.length);
}
}
}
}
Font size:
<select name="sizeselect" onchange="font([ques1,ques2,opt1,opt2,opt3,opt4],'font',this.value)">
<option value="select">select</option>
<option value="10">10</option>
<option value="13">13</option>
<option value="15">15</option>
<option value="17">17</option>
<option value="19">19</option>
<option value="21">21</option>
<option value="23">23</option>
<option value="50">50</option>
</select>
Actually what i'm trying to do is, take our reply option as example. While u r clicking reply, the textarea with font name select,size select, color select is there.Like this i'm trying to do.