Код: <style>
input.ed_buttons
{
background: #000000;
width: 22px;
border: 0px;
height: 22px;
cursor: hand;
border: 1px dotted b0b0b0;
margin-bottom: 3px;
font-face: Verdana;
font-size: 17px;
font-weight: bold;
color: red;
}
</style>
<script>
// Load Quicktags JavaScript
var edButtons = new Array();
var edSmiles = new Array();
var edOpenTags = new Array();
function edButton(id, display, tagStart, tagEnd, access, open, image) {
this.id = id; // used to name the toolbar button
this.display = display; // label on button
this.tagStart = tagStart; // open tag
this.tagEnd = tagEnd; // close tag
this.access = access; // access key
this.open = open; // set to -1 if tag does not need to be closed
this.image = image; // set to -1 if tag does not need to be closed
}
function edSmile(id, title) {
this.id = id; // used to name the toolbar button
this.title = title; // used to name the toolbar button
}
// Start code
function edShowButton(button, i) {
if (button.id == 'ed_img') {
document.write('<input type="button" style="background: url(templates/default/img/buttons/' + button.image + '.gif);" id="' + button.id + '" accesskey="' + button.access + '" class="ed_buttons" onclick="edInsertImage(edCanvas);"> ');
document.write(' <span style="font-size: 20px; color: e0e0e0;">|</span> ');
}
else if (button.id == 'ed_link') {
document.write('<input type="button" style="background: url(templates/default/img/buttons/' + button.image + '.gif);" id="' + button.id + '" accesskey="' + button.access + '" class="ed_buttons" onclick="edInsertLink(edCanvas, ' + i + ');"> ');
}
else {
document.write('<input type="button" style="background: url(templates/default/img/buttons/' + button.image + '.gif);" id="' + button.id + '" accesskey="' + button.access + '" class="ed_buttons" onclick="edInsertTag(edCanvas, ' + i + ');" > ');
if (button.id == 'u' || button.id == 'right' || button.id == 'quote')
document.write(' <span style="font-size: 20px; color: e0e0e0;">|</span> ');
}
}
function edShowSmile(smile, i) {
document.write('<td width=40 style="border: 1px dotted #c0c0c0;" nowrap align="center" valign="center" onclick="edInsertContent(edCanvas, \'' + smile.title + '\');"><img src="templates/default/img/smiles/' + smile.id + '.gif" title="' + smile.title + '" id="' + smile.title + '"></td>');
if ((i+1)%4 == 0 && (i+1) != 36)
document.write('</tr><tr height=40>');
}
function edAddTag(button) {
if (edButtons[button].tagEnd != '') {
edOpenTags[edOpenTags.length] = button;
document.getElementById(edButtons[button].id).value = 'X' + document.getElementById(edButtons[button].id).value;
}
}
function edRemoveTag(button) {
for (i = 0; i < edOpenTags.length; i++) {
if (edOpenTags
== button) {
edOpenTags.splice(i, 1);
document.getElementById(edButtons[button].id).value = document.getElementById(edButtons[button].id).value.replace('X', '');
}
}
}
function edCheckOpenTags(button) {
var tag = 0;
for (i = 0; i < edOpenTags.length; i++) {
if (edOpenTags[i] == button) {
tag++;
}
}
if (tag > 0) {
return true; // tag found
}
else {
return false; // tag not found
}
}
function edCloseAllTags() {
var count = edOpenTags.length;
for (o = 0; o < count; o++) {
edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]);
}
}
function edToolbar() {
document.write('<span id="ed_comment_toolbar">');
for (i = 0; i < edButtons.length; i++) {
edShowButton(edButtons[i], i);
}
document.write('<input type="button" id="ed_close" style="background: url(templates/default/img/buttons/close.gif);" class="ed_buttons" onclick="edCloseAllTags();" title="Close all open tags" >');
document.write('</span>');
}
function edSmilesbar() {
document.write('<span id="ed_Smiles_toolbar">');
for (i = 0; i < edSmiles.length; i++) {
edShowSmile(edSmiles[i], i);
}
document.write('</span>');
}
// insertion code
function edInsertTag(myField, i) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
if (sel.text.length > 0) {
sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
}
else {
if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
sel.text = edButtons[i].tagStart;
edAddTag(i);
}
else {
sel.text = edButtons[i].tagEnd;
edRemoveTag(i);
}
}
myField.focus();
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
var scrollTop = myField.scrollTop;
if (startPos != endPos) {
myField.value = myField.value.substring(0, startPos)
+ edButtons[i].tagStart
+ myField.value.substring(startPos, endPos)
+ edButtons[i].tagEnd
+ myField.value.substring(endPos, myField.value.length);
cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
}
else {
if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
myField.value = myField.value.substring(0, startPos)
+ edButtons[i].tagStart
+ myField.value.substring(endPos, myField.value.length);
edAddTag(i);
cursorPos = startPos + edButtons[i].tagStart.length;
}
else {
myField.value = myField.value.substring(0, startPos)
+ edButtons[i].tagEnd
+ myField.value.substring(endPos, myField.value.length);
edRemoveTag(i);
cursorPos = startPos + edButtons[i].tagEnd.length;
}
}
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
myField.scrollTop = scrollTop;
}
else {
if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
myField.value += edButtons[i].tagStart;
edAddTag(i);
}
else {
myField.value += edButtons[i].tagEnd;
edRemoveTag(i);
}
myField.focus();
}
}
function edInsertContent(myField, myValue) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
myField.focus();
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
myField.focus();
myField.selectionStart = startPos + myValue.length;
myField.selectionEnd = startPos + myValue.length;
} else {
myField.value += myValue;
myField.focus();
}
}
function edInsertLink(myField, i, defaultValue) {
if (!defaultValue) {
defaultValue = 'http://';
}
if (!edCheckOpenTags(i)) {
var URL = prompt('Введите ссылку:' ,defaultValue);
if (URL) {
var URL_NAME = prompt('Введите название ссылки' ,'');
if (!URL_NAME) {
URL_NAME = 'URL';
}
edButtons[i].tagStart = '[url name=' + URL_NAME + ']' + URL + '[/url]';
edInsertTag(myField, i);
}
}
else {
edInsertTag(myField, i);
}
}
function edInsertImage(myField) {
var myValue = prompt('Enter the URL of the image', 'http://');
if (myValue) {
myValue = ' ';
edInsertContent(myField, myValue);
}
}
</script>
<form action="?go=add_replay&t=<? echo $topic_id;?>" method="post" name="post" id="commentform">
<!-- BEGIN - LMB^Box Comment Quicktags Version 2.4 - Display //-->
<span id="comment_quicktags">
<script type="text/javascript" language="javascript">
<!--
edButtons[edButtons.length] = new edButton('b','B','','','b','','bold');
edButtons[edButtons.length] = new edButton('i','I','[i]','','i','','italic');
edButtons[edButtons.length] = new edButton('u','U','
','','u','','underline');
edButtons[edButtons.length] = new edButton('left','LEFT','[left]','[/left]','left','','justifyleft');
edButtons[edButtons.length] = new edButton('center','center','
','
','center','','justifycenter');
edButtons[edButtons.length] = new edButton('right','right','[right]','[/right]','right','','justifyright');
edButtons[edButtons.length] = new edButton('ed_link','Link','','','a','','createlink');
edButtons[edButtons.length] = new edButton('ed_img','Image','','','','','insertimage');
edButtons[edButtons.length] = new edButton('code','Code','
Код: ','