TOP /リクエスト テキストエリアにタグを挿入する


font color
<script language="JavaScript"><!--

function text_command(c){
t = document.msg_form.comment.value;
if(c=="b")com="<b></b>";
if(c=="i")com="<i></i>";
if(c=="u")com="<u></u>";
document.msg_form.comment.value =t + com;
}
function text_size(s){
t = document.msg_form.comment.value;
com="<font size=\""+ s +"\"></font>";
document.msg_form.comment.value =t + com;
document.msg_form.size_select.options[2].selected=true;
}
function text_color(co){
t = document.msg_form.comment.value;
com="<font color=\""+ co +"\"></font>";
document.msg_form.comment.value =t + com;
document.msg_form.color_select.options[0].selected=true;
}/*himajin.moo.jp*/

// --></script>
<form name="msg_form">
<textarea name="comment" cols=40 rows=10></textarea><br>
<input type=button onclick="text_command('b');"value="B"style="font-weight: bold;width:16"><input
 type=button onclick="text_command('i');"value="I"style="font-style: italic;width:16"><input
 type=button onclick="text_command('u');"value="U"style="text-decoration: underline;width:16">
<font size=2>font</font><select name="size_select"onchange="text_size(this.value)">
   <option value=1>1
   <option value=2>2
   <option value=3 selected>3
   <option value=4>4
   <option value=5>5
  </select>
<font size=2>color</font><select name="color_select"onchange="text_color(this.value)">
   <option value=black>black
   <option value=red style="color:red;">red
   <option value=blue style="color:blue;">blue
   <option value=orange style="color:orange;">orange
   <option value=green style="color:green;">green
  </select>
</form>