Единый форум поддержки

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Единый форум поддержки » Корзина » Не работает транслит


Не работает транслит

Сообщений 1 страница 2 из 2

1

Помогите пожалуйста с транслитом. Уже ставила пять разных всеравно не работает ни в мозиле, ни в эксплорере.
Ставила в форму ответа вот эти два скрипта. Уже и смайлы убирала ставила скрипты в "чистую" форму ответа, результата нет. http://schnauzer.2bb.ru/

<!--
var rus_lr2 = ('Е-е-О-о-Ё-Ё-Ё-Ё-Ж-Ж-Ч-Ч-Ш-Ш-Щ-Щ-Ъ-Ь-Э-Э-Ю-Ю-Я-Я-Я-Я-ё-ё-ж-ч-ш-щ-э-ю-я-я').split('-');
var lat_lr2 = ('/E-/e-/O-/o-ЫO-Ыo-ЙO-Йo-ЗH-Зh-ЦH-Цh-СH-Сh-ШH-Шh-ъ'+String.fromCharCode(35)+'-ь'+String.fromCharCode(39)+'-ЙE-Йe-ЙU-Йu-ЙA-Йa-ЫA-Ыa-ыo-йo-зh-цh-сh-шh-йe-йu-йa-ыa').split('-');
var rus_lr1 = ('А-Б-В-Г-Д-Е-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Х-Ц-Щ-Ы-Я-а-б-в-г-д-е-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-х-ц-щ-ъ-ы-ь-ь-я').split('-');
var lat_lr1 = ('A-B-V-G-D-E-Z-I-J-K-L-M-N-O-P-R-S-T-U-F-H-X-C-W-Y-Q-a-b-v-g-d-e-z-i-j-k-l-m-n-o-p-r-s-t-u-f-h-x-c-w-'+String.fromCharCode(35)+'-y-'+String.fromCharCode(39)+'-'+String.fromCharCode(96)+'-q').split('-');
var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-');
var lat_rl = ('A-B-V-G-D-E-JO-ZH-Z-I-J-K-L-M-N-O-P-R-S-T-U-F-H-C-CH-SH-SHH-'+String.fromCharCode(35)+String.fromCharCode(35)+'-Y-'+String.fromCharCode(39)+String.fromCharCode(39)+'-JE-JU-JA-a-b-v-g-d-e-jo-zh-z-i-j-k-l-m-n-o-p-r-s-t-u-f-h-c-ch-sh-shh-'+String.fromCharCode(35)+'-y-'+String.fromCharCode(39)+'-je-ju-ja').split('-');
var translitown=0;var language = 0;
if (document.images) {swrus_src = new Image; swrus_src = "pict/swrus.gif";swlat_src = new Image; swlat_src = "pict/swlat.gif";}
function setfoc(){document.post.message.focus();}
function compbelongs(isprivate)
{
translitown = isprivate;
if (translitown==1) {document.post.message.createTextRange().execCommand("Copy");}
document.cookie = "trowncomputer=" + escape(isprivate);
return true;
}
function upgradeclipboard()
{
if (translitown==1) {document.post.message.createTextRange().execCommand("Copy");}
return true;
}
function setlangpicture(){document.ruslat.src = swrus_src;}
function changelanguage(){if (language==1) {language=0; document.images['ruslat'].src = swrus_src; document.post.message.focus();return;}if (language==0) {language=1; document.images['ruslat'].src = swlat_src; document.post.message.focus();return;}}
function AkeyIsDown()
{
if (event.ctrlKey && event.altKey) changelanguage();
if (window.event.keyCode==27) event.returnValue=false;
return false;
}
function translate_letter()
{
if (language==1) return; //no transliteration necessary
//the entered character
var code = event.keyCode;
txt=String.fromCharCode(code);
//make selection
cursor_pos_selection = document.selection.createRange();
//delete something is selected before
cursor_pos_selection.text="";
//get the previous character
cursor_pos_selection.moveStart("character",-1);
pretxt = cursor_pos_selection.text;
if (pretxt.length>1) {pretxt="";}
event.keyCode = 0;
result = translatesymboltocyrillic(pretxt,txt)
//delete the previous symbol if it is exists (if the entered symbol is not the first one)
if (pretxt!="") { cursor_pos_selection.select(); cursor_pos_selection.collapse();}
with(document.selection.createRange()) {text = result; collapse(); select()}
return;
}
function translatesymboltocyrillic(pretxt,txt)
{
var doubletxt = pretxt+txt;
var code = txt.charCodeAt(0);
if (!(((code>=65) && (code<=123))||(code==35)||(code==39))) return doubletxt;
var ii;
for (ii=0; ii<lat_lr2.length; ii++)
{
if (lat_lr2[ii]==doubletxt) return rus_lr2[ii];
}
for (ii=0; ii<lat_lr1.length; ii++)
{
if (lat_lr1[ii]==txt) return pretxt+rus_lr1[ii];
}
return doubletxt;
}
function translatesymboltolatin(symb)
{
var ii;
for (ii=0; ii<rus_rl.length; ii++)
{
if (rus_rl[ii]==symb)
return lat_rl[ii];
}
return symb;
}
function translateAlltoCyrillic()
{
var is_selection_flag = 1;
var userselection = document.selection.createRange();
var txt = userselection.text;
if (userselection==null || userselection.text==null || userselection.parentElement==null || userselection.parentElement().type!="textarea")
{
// no text selected, all the text in the textarea is to be processed
is_selection_flag = 0;
txt = document.post.message.value;
}
var txtnew = translatesymboltocyrillic("",txt.substr(0,1));
var symb = "";
for (kk=1;kk<txt.length;kk++)
{
symb = translatesymboltocyrillic(txtnew.substr(txtnew.length-1,1),txt.substr(kk,1));
txtnew = txtnew.substr(0,txtnew.length-1) + symb;
}
if (is_selection_flag)
{
userselection.text = txtnew; userselection.collapse(); userselection.select();
}
else
{
document.post.message.value = txtnew;
document.post.message.focus();
}
return;
}
function translateAlltoLatin()
{
var is_selection_flag = 1;
var userselection = document.selection.createRange();
var txt = userselection.text;

if (userselection==null || userselection.text==null || userselection.parentElement==null || userselection.parentElement().type!="textarea")
{
// no text selected, all the text in the textarea is to be processed
is_selection_flag = 0;
txt = document.post.message.value;
}
txtnew="";
var symb = "";
for (kk=0;kk<txt.length;kk++)
{
symb = translatesymboltolatin(txt.substr(kk,1));
txtnew = txtnew.substr(0,txtnew.length) + symb;
}
if (is_selection_flag)
{
userselection.text = txtnew; userselection.collapse(); userselection.select();
}
else
{
document.post.message.value = txtnew;
document.post.message.focus();
}
return;
}
//-->
</SCRIPT>
<br /> <INPUT class=button onclick=translateAlltoCyrillic();upgradeclipboard(); type=button value="в кириллицу">&nbsp;&nbsp;&nbsp;
<INPUT class=button onclick=translateAlltoLatin();upgradeclipboard(); type=button value="в латиницу"><br />

<div align="center"><b>TRANSLIT > Русский</b></div>
<!--Script by Vlad S-du icq 5510444-->
<SCRIPT LANGUAGE="JavaScript"><!--Script by Vlad S-du icq 5510444 v.1.1-->
var lat=new Array("jo","zh","i'","ch","sh","xh","je","ju","ja","a","b","v","g","d","e","z","i","k","l","m","n","o","p","r","s","t","u","f","x","c","'","    y","`","j","h");
var cyr=new Array("ё","ж","й","ч","ш","щ","э","ю","я","а","б","в","г","д","е","з","и","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы","ъ","ж    ","х");

var latcap=new Array("JO","Jo","ZH","Zh","I'","Ch","CH","Sh","SH","Xh","XH","Je","JE","Ju","JU","Ja","JA","A","B","V","G","D","E","Z","I","K","L","M","N","    O","P","R","S","T","U","F","X","C","Y","J","H");
var cyrcap=new Array("Ё","Ё","Ж","Ж","Й","Ч","Ч","Ш","Ш","Щ","Щ","Э","Э","Ю","Ю","Я","Я","А","Б","В","Г","Д","Е","З","И","К","Л","М","Н","О","П","Р","С","Т    ","У","Ф","Х","Ц","Ы","Ж","Х");

function translate(tex)
{
var buf=tex;
var i;
for (i=0;i<latcap.length;i++)
      {
      buf=replace(buf,latcap[i],cyrcap[i],1,0);
      }

for (i=0;i<lat.length;i++)
      {
      buf=replace(buf,lat[i],cyr[i],1,0);
      }
<!--Scripy by Vlad S-du icq 5510444-->
tex=buf;
return tex;
}

function replace(target,oldTerm,newTerm,caseSens,wordOnly) {

      var work = target;
      var ind = 0;
      var next = 0;

      if (!caseSens) {
        oldTerm = oldTerm.toLowerCase();
        work = target.toLowerCase();
      }

      while ((ind = work.indexOf(oldTerm,next)) >= 0) {
        if (wordOnly) {
          var before = ind - 1;
          var after = ind + oldTerm.length;
          if (!(space(work.charAt(before)) && space(work.charAt(after)))) {
            next = ind + oldTerm.length;
            continue;
          }
        }
        target = target.substring(0,ind) + newTerm +
        target.substring(ind+oldTerm.length,target.length);
        work = work.substring(0,ind) + newTerm +
        work.substring(ind+oldTerm.length,work.length);
        next = ind + newTerm.length;
        if (next >= work.length) { break; }
      }

      return target;

}

</SCRIPT>

<FORM METHOD="POST">
<textarea name=text2 cols=50 rows=17 wrap=virtual>
1-nabiraete tekst v okne po zadannym pravilam
2-najimaite na "Perevod".
3 - Gotovo!
По вопросам транслита - ICQ 5510444.

Vot pravilo!
"JO","Jo","ZH","Zh","I'","Ch","CH","Sh","SH","Xh","XH","Je","JE","Ju","JU","Ja","JA","A","B","V","G","D","E","Z","I","K","L","M","N","    O","P","R","S","T","U","F","X","C","Y","J","H"
"Ё","Ё","Ж","Ж","Й","Ч","Ч","Ш","Ш","Щ","Щ","Э","Э","Ю","Ю","Я","Я","А","Б","В","Г","Д","Е","З","И","К","Л","М","Н","О","П","Р","С","Т    ","У","Ф","Х","Ц","Ы","Ж","Х"

http://10bb.ru ! :)
</textarea><BR>
<input type=button value="Перевод" onclick="document.forms[0].text2.value=translate(document.forms[0].text2.value);">
<input type=button value="Очистить" onclick="document.forms[0].text2.value='';">
</FORM>

Отредактировано 8866 (Ср, 9 Дек 2009 19:51:06)

0

2

8866
Пробуйте ставить в ХТМЛ-форма ответа это:

Код:
<SCRIPT language=JavaScript> 
<!-- 
var rus_lr2 = ('Е-е-О-о-Ё-Ё-Ё-Ё-Ж-Ж-Ч-Ч-Ш-Ш-Щ-Щ-Ъ-Ь-Э-Э-Ю-Ю-Я-Я-Я-Я-ё-ё-ж-ч-ш-щ-э-ю-я-я').split('-'); 
var lat_lr2 = ('/E-/e-/O-/o-ЫO-Ыo-ЙO-Йo-ЗH-Зh-ЦH-Цh-СH-Сh-ШH-Шh-ъ'+String.fromCharCode(35)+'-ь'+String.fromCharCode(39)+'-ЙE-Йe-ЙU-Йu-ЙA-Йa-ЫA-Ыa-ыo-йo-зh-цh-сh-шh-йe-йu-йa-ыa').split('-'); 
var rus_lr1 = ('А-Б-В-Г-Д-Е-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Х-Ц-Щ-Ы-Я-а-б-в-г-д-е-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-х-ц-щ-ъ-ы-ь-ь-я').split('-'); 
var lat_lr1 = ('A-B-V-G-D-E-Z-I-J-K-L-M-N-O-P-R-S-T-U-F-H-X-C-W-Y-Q-a-b-v-g-d-e-z-i-j-k-l-m-n-o-p-r-s-t-u-f-h-x-c-w-'+String.fromCharCode(35)+'-y-'+String.fromCharCode(39)+'-'+String.fromCharCode(96)+'-q').split('-'); 
var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-'); 
var lat_rl = ('A-B-V-G-D-E-JO-ZH-Z-I-J-K-L-M-N-O-P-R-S-T-U-F-H-C-CH-SH-SHH-'+String.fromCharCode(35)+String.fromCharCode(35)+'-Y-'+String.fromCharCode(39)+String.fromCharCode(39)+'-JE-JU-JA-a-b-v-g-d-e-jo-zh-z-i-j-k-l-m-n-o-p-r-s-t-u-f-h-c-ch-sh-shh-'+String.fromCharCode(35)+'-y-'+String.fromCharCode(39)+'-je-ju-ja').split('-'); 
var translitown=0;var language = 0; 
if (document.images) {swrus_src = new Image; swrus_src = "pict/swrus.gif";swlat_src = new Image; swlat_src = "pict/swlat.gif";} 
function setfoc(){document.post.message.focus();} 
function compbelongs(isprivate) 
{ 
translitown = isprivate; 
if (translitown==1) {document.post.message.createTextRange().execCommand("Copy");} 
document.cookie = "trowncomputer=" + escape(isprivate); 
return true; 
} 
function upgradeclipboard() 
{ 
if (translitown==1) {document.post.message.createTextRange().execCommand("Copy");} 
return true; 
} 
function setlangpicture(){document.ruslat.src = swrus_src;} 
function changelanguage(){if (language==1) {language=0; document.images['ruslat'].src = swrus_src; document.post.message.focus();return;}if (language==0) {language=1; document.images['ruslat'].src = swlat_src; document.post.message.focus();return;}} 
function AkeyIsDown() 
{ 
if (event.ctrlKey && event.altKey) changelanguage(); 
if (window.event.keyCode==27) event.returnValue=false; 
return false; 
} 
function translate_letter() 
{ 
if (language==1) return; //no transliteration necessary 
//the entered character 
var code = event.keyCode; 
txt=String.fromCharCode(code); 
//make selection 
cursor_pos_selection = document.selection.createRange(); 
//delete something is selected before 
cursor_pos_selection.text=""; 
//get the previous character 
cursor_pos_selection.moveStart("character",-1); 
pretxt = cursor_pos_selection.text; 
if (pretxt.length>1) {pretxt="";} 
event.keyCode = 0; 
result = translatesymboltocyrillic(pretxt,txt) 
//delete the previous symbol if it is exists (if the entered symbol is not the first one) 
if (pretxt!="") { cursor_pos_selection.select(); cursor_pos_selection.collapse();} 
with(document.selection.createRange()) {text = result; collapse(); select()} 
return; 
} 
function translatesymboltocyrillic(pretxt,txt) 
{ 
var doubletxt = pretxt+txt; 
var code = txt.charCodeAt(0); 
if (!(((code>=65) && (code<=123))||(code==35)||(code==39))) return doubletxt; 
var ii; 
for (ii=0; ii<lat_lr2.length; ii++) 
{ 
if (lat_lr2[ii]==doubletxt) return rus_lr2[ii]; 
} 
for (ii=0; ii<lat_lr1.length; ii++) 
{ 
if (lat_lr1[ii]==txt) return pretxt+rus_lr1[ii]; 
} 
return doubletxt; 
} 
function translatesymboltolatin(symb) 
{ 
var ii; 
for (ii=0; ii<rus_rl.length; ii++) 
{ 
if (rus_rl[ii]==symb) 
return lat_rl[ii]; 
} 
return symb; 
} 
function translateAlltoCyrillic() 
{ 
var is_selection_flag = 1; 
var userselection = document.selection.createRange(); 
var txt = userselection.text; 
if (userselection==null || userselection.text==null || userselection.parentElement==null || userselection.parentElement().type!="textarea") 
{ 
// no text selected, all the text in the textarea is to be processed 
is_selection_flag = 0; 
txt = document.post.message.value; 
} 
var txtnew = translatesymboltocyrillic("",txt.substr(0,1)); 
var symb = ""; 
for (kk=1;kk<txt.length;kk++) 
{ 
symb = translatesymboltocyrillic(txtnew.substr(txtnew.length-1,1),txt.substr(kk,1)); 
txtnew = txtnew.substr(0,txtnew.length-1) + symb; 
} 
if (is_selection_flag) 
{ 
userselection.text = txtnew; userselection.collapse(); userselection.select(); 
} 
else 
{ 
document.post.message.value = txtnew; 
document.post.message.focus(); 
} 
return; 
} 
function translateAlltoLatin() 
{ 
var is_selection_flag = 1; 
var userselection = document.selection.createRange(); 
var txt = userselection.text; 
 
if (userselection==null || userselection.text==null || userselection.parentElement==null || userselection.parentElement().type!="textarea") 
{ 
// no text selected, all the text in the textarea is to be processed 
is_selection_flag = 0; 
txt = document.post.message.value; 
} 
txtnew=""; 
var symb = ""; 
for (kk=0;kk<txt.length;kk++) 
{ 
symb = translatesymboltolatin(txt.substr(kk,1)); 
txtnew = txtnew.substr(0,txtnew.length) + symb; 
} 
if (is_selection_flag) 
{ 
userselection.text = txtnew; userselection.collapse(); userselection.select(); 
} 
else 
{ 
document.post.message.value = txtnew; 
document.post.message.focus(); 
} 
return; 
} 
//--> 
</SCRIPT> 
<br /> <INPUT class=button onclick=translateAlltoCyrillic();upgradeclipboard(); type=button value="Рус.">&nbsp;&nbsp;&nbsp; 
<INPUT class=button onclick=translateAlltoLatin();upgradeclipboard(); type=button value="Лат.">

0


Вы здесь » Единый форум поддержки » Корзина » Не работает транслит