|
<?php
<script>
function tag(text1, text2) {
if ((document.selection)) {
document.message.msg.focus();
document.message.document.selection.createRange().text = text1 + document.message.document.selection.createRange().text + text2;
} else if (document.forms['message'].elements['msg'].selectionStart != undefined) {
var element = document.forms['message'].elements['msg'];
var len = document.message.msg.selectionStart;
var str = element.value;
var scroll = document.message.msg.scrollTop;
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);
var scroll2 = scroll + text1.length + text2.length + length;
document.message.msg.scrollTop = scroll2;
var len2 = text1.length + len + text2.length + length;
document.message.msg.setSelectionRange(len2,len2);
document.message.msg.focus();
} else {
document.message.msg.value += text1 + text2;
}
}
</script>
<a class='panel' href="javascript:tag('[url=http://]', '[/url]')"><img src="/images/bb/l.png" alt="url" title="Ссылка"></a>
<a class='panel' href="javascript:tag('[b]', '[/b]')"><img src="/images/bb/b.png" alt="b" title="Жирный"></a>
<a class='panel' href="javascript:tag('[i]', '[/i]')"><img src="/images/bb/i.png" alt="i" title="Наклонный"></a>
<a class='panel' href="javascript:tag('[u]', '[/u]')"><img src="/images/bb/u.png" alt="u" title="Подчёркнутый"></a>
<a class='panel' href="javascript:tag('[s]', '[/s]')"><img src="/images/bb/s.png" alt="s" title="Перечёркнутый"></a>
<a class='panel' href="javascript:tag('[red]', '[/red]')"><img src="/images/bb/red.png" alt="s" title="Красный"></a>
<a class='panel' href="javascript:tag('[blue]', '[/blue]')"><img src="/images/bb/blue.png" alt="s" title="Синий"></a>
<a class='panel' href="javascript:tag('[green]', '[/green]')"><img src="/images/bb/green.png" alt="s" title="Зеленый"></a>
<a class='panel' href="javascript:tag('[cit]', '[/cit]')"><img src="/images/bb/q.png" alt="q" title="Цитата"></a><br>
?>