I don't know if the code is pretty good but I changed my nlp_usertextformatting template to this and wanted to share it with you guys:
PHP Code:
<script type="text/javascript" language="javascript">
<!--
var prefix = 'sel_nlp_usertextformatting_';
function nlp_usertextformatting(req) {
switch(req) {
case 'color':
fetch_object(prefix + 'fontcolor').style.backgroundColor = fetch_object(prefix + 'fontcolor').value;
nlp_usertextformatting('set');
break;
case 'set':
fetch_object(prefix + 'preveiw').style.color = (fetch_object(prefix + 'fontcolor').value != -1) ? fetch_object(prefix + 'fontcolor').value : '';
fetch_object(prefix + 'preveiw_size').setAttribute("size", (fetch_object(prefix + 'fontsize').value != -1) ? fetch_object(prefix + 'fontsize').value : '');
fetch_object(prefix + 'preveiw').style.fontFamily = (fetch_object(prefix + 'fonttype').value != -1) ? fetch_object(prefix + 'fonttype').value : '';
fetch_object(prefix + 'preveiw').style.fontStyle = fetch_object(prefix + 'italic').checked ? 'italic' : 'normal';
<vb:if condition="is_browser('ie')">document.all.sel_nlp_usertextformatting_preveiw.style.fontWeight<vb:else />fetch_object(prefix + 'preveiw').style.fontWeight</vb:if> = fetch_object(prefix + 'fontweight').checked ? 'bold' : 'normal';
break;
case 'reset':
fetch_object(prefix + 'fontcolor').value = fetch_object(prefix + 'fonttype').value = fetch_object(prefix + 'fontsize').value = '-1';
fetch_object(prefix + 'fontweight').checked = false;
fetch_object(prefix + 'preveiw_size').removeAttribute('size');
fetch_object(prefix + 'preveiw').style.color = fetch_object(prefix + 'preveiw').style.fontFamily = fetch_object(prefix + 'preveiw').style.fontWeight = fetch_object(prefix + 'fontcolor').style.backgroundColor = fetch_object(prefix + 'preveiw').style.fontStyle = '';
}
}
//-->
</script>
<fieldset class="blockrow">
<legend>{vb:rawphrase nlp_usertextformatting_title}</legend>
<p class="description">{vb:rawphrase nlp_usertextformatting_description}</p>
<table width="100%">
<tr>
<td width="50%"><label for="sel_nlp_usertextformatting_fonttype">{vb:rawphrase nlp_usertextformatting_fonttype}</label></td>
<td width="50%"><select onchange="nlp_usertextformatting('set');" name="nlp_usertextformatting_fonttype" id="sel_nlp_usertextformatting_fonttype">
<option value="-1">{vb:rawphrase use_forum_default}</option>
{vb:raw UserTF.Fonts}
</select></td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td width="50%"><label for="sel_nlp_usertextformatting_fontsize">
{vb:rawphrase nlp_usertextformatting_fontsize}</label></td>
<td width="50%"><select onchange="nlp_usertextformatting('set');" name="nlp_usertextformatting_fontsize" id="sel_nlp_usertextformatting_fontsize">
<option value="-1">{vb:rawphrase use_forum_default}</option>
{vb:raw UserTF.Size}
</select></td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td width="50%"><label for="sel_nlp_usertextformatting_fontcolor">{vb:rawphrase nlp_usertextformatting_fontcolor}</label></td>
<td width="50%"><select
<vb:if condition="$GLOBALS['vbulletin']->usertextformatting['font'] != -1">style="background-color: {vb:raw usertextformatting.color};"</vb:if> onchange="nlp_usertextformatting('color');" name="nlp_usertextformatting_fontcolor" id="sel_nlp_usertextformatting_fontcolor">
<option value="-1" style="background-color: white;">{vb:rawphrase use_forum_default}</option>
{vb:raw UserTF.Colors}
</select></td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td width="49%"><label for="sel_nlp_usertextformatting_fontweight">
<input onChange="nlp_usertextformatting('set');" onClick="nlp_usertextformatting('set');" type="checkbox" name="nlp_usertextformatting_fontweight" value="1" id="sel_nlp_usertextformatting_fontweight" {vb:raw usertf.weight} />
{vb:rawphrase nlp_usertextformatting_fontweight} </label>
<br>
<label for="sel_nlp_usertextformatting_italic" style="font-style: italic">
<input onChange="nlp_usertextformatting('set');" onClick="nlp_usertextformatting('set');" type="checkbox" name="nlp_usertextformatting_italic" value="1" id="sel_nlp_usertextformatting_italic" {vb:raw usertf.italic} />
{vb:rawphrase nlp_usertextformatting_italic} </label></td>
<td width="51%"><p class="description"> </p>
<!-- start -->
<p class="description" align="center" id="sel_nlp_usertextformatting_preveiw" style="<vb:if condition="$GLOBALS['vbulletin']->usertextformatting['font'] != -1">font-family: {vb:raw usertextformatting.font};</vb:if><vb:if condition="$GLOBALS['vbulletin']->usertextformatting['color'] != -1">color: {vb:raw usertextformatting.color};</vb:if><vb:if condition="$GLOBALS['vbulletin']->usertextformatting['weight'] == 'bold'">font-weight: bold<vb:else />font-weight: normal</vb:if>">
<font id="sel_nlp_usertextformatting_preveiw_size" <vb:if condition="$GLOBALS['vbulletin']->usertextformatting['size'] != -1">size="{vb:raw usertextformatting.size}"</vb:if>>{vb:rawphrase nlp_usertextformatting_preveiw}</font> </p></td>
</tr>
</table>
<br><br>
<div align="left">
<input type="button" class="button" onclick="javascript:nlp_usertextformatting('reset');" value="{vb:rawphrase nlp_usertextformatting_reset}" />
</div>
</fieldset>