File size: 2.35Kb
<script language="JavaScript" type="text/javascript">
function tag(text1, text2) {
if ((document.selection)) {
document.form.msg.focus();
document.form.document.selection.createRange().text = text1+document.form.document.selection.createRange().text+text2;
} else if(document.forms['form'].elements['text'].selectionStart!=undefined) {
var element = document.forms['form'].elements['text'];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
} else document.form.msg.value += text1+text2;
}
</script>
<div class="posts">
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[b]', '[/b]');" title="Жирный текст"><b style="font-size:14px;">B</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[i]', '[/i]');" title="Наклонный текст"><b style="font-size:14px;">I</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[u]', '[/u]');" title="Подчеркнутый текст"><b style="font-size:14px;">U</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[s]', '[/s]');" title="Зачеркнутый текст"><b style="font-size:14px;">S</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[php]', '[/php]');" title="Подвеска php"><b style="font-size:14px;">php</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[small]', '[/small]');" title="Маленький шрифт"><b style="font-size:14px;">small</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[url=http://]', '[/url]');" title="Ссылка"><b style="font-size:14px;">url</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[img]', '[/img]');" title="Картинка"><b style="font-size:14px;">img</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[spoiler=]', '[/spoiler]');" title="Спойлер"><b style="font-size:14px;">Спойлер</b></a></span>
<span class="bb_codes"><a href="#form" onclick="javascript:tag('[hide]', '[/hide]');" title="Скрытый текст"><b style="font-size:14px;">Скрытый</b></a></span>
</div>