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