Вход Регистрация
Файл: mydcms.tk/js/bbcode.js
Строк: 67
<?php
// JavaScript Document

function savesel(doc)
        {
                if(
document.selection) {                
                        
doc.sel document.selection.createRange().duplicate();
                }               
        }
        function 
click_bb(aid,Open,Close) {
                var 
doc document.getElementById(aid);
                
doc.focus();
                if (
window.attachEvent && navigator.userAgent.indexOf('Opera') === -1) {                                        
                        var 
doc.sel;
                        if(
s){                                  
                                var 
s.text.length;
                                
s.text Open s.text Close;
                                
s.moveEnd("character", -Close.length);
                                
s.moveStart("character", -l);                                           
                                
s.select();                
                        }
                }   else {                                              
                        var 
ss doc.scrollTop;
                        
sel1 doc.value.substr(0doc.selectionStart);
                        
sel2 doc.value.substr(doc.selectionEnd);
                        
sel doc.value.substr(doc.selectionStartdoc.selectionEnd doc.selectionStart);                                              
                        
doc.value sel1 Open sel Close sel2;
                        
doc.selectionStart sel1.length Open.length;
                        
doc.selectionEnd doc.selectionStart sel.length;
                        
doc.scrollTop ss;                                             
                }
                return 
false;
        }



function 
bb_u(id)
{
// подчеркивание
click_bb(id,'[u]','[/u]');
}
function 
bb_i(id)
{
// курсив
click_bb(id,'[i]','[/i]');
}
function 
bb_b(id)
{
// жирный
click_bb(id,'[b]','[/b]');
}
function 
bb_url(id)
{
click_bb(id,'[url=]','[/url]');
}
function 
bb_img(id)
{
click_bb(id,'[img]','[/img]');
}
function 
bb_s(id)
{
click_bb(id,'[s]','[/s]');
}
function 
bb_q(id)
{
click_bb(id,'[q]','[/q]');
}
function 
bb_blue(id)
{
click_bb(id,'[blue]','[/blue]');
}
function 
bb_green(id)
{
click_bb(id,'[green]','[/green]');
}
function 
bb_black(id)
{
click_bb(id,'[black]','[/black]');
}
function 
bb_red(id)
{
click_bb(id,'[red]','[/red]');
}
function 
bb_yellow(id)
{
click_bb(id,'[yellow]','[/yellow]');
}
?>
Онлайн: 2
Реклама