Файл: js/qbbcodes2.js
Строк: 54
<?php
function tag(text1, text2) {
if ((document.selection)) {
document.message.article.focus();
document.message.document.selection.createRange().text = text1 + document.message.document.selection.createRange().text + text2;
} else if (document.forms['message'].elements['article'].selectionStart != undefined) {
var element = document.forms['message'].elements['article'];
var len = document.message.article.selectionStart;
var str = element.value;
var scroll = document.message.article.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.article.scrollTop = scroll2;
var len2 = text1.length + len + text2.length + length;
document.message.article.setSelectionRange(len2,len2);
document.message.article.focus();
} else {
document.message.article.value += text1 + text2;
}
}
?>