daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Apr 22nd, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var rusChars = new Array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ч','Ц','Ш','Щ','Э','Ю','Я','Ы','Ъ','Ь','Ё','а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ч','ц','ш','щ','э','ю','я','ы','ъ','ь','ё');
  2.  
  3. var transChars = new Array('A','B','V','G','D','E','Jo','Zh','Z','I','J','K','L','M','N','O','P','R','S','T','U','F','H','Ch','C','Sh','Shch','E','Ju','Ja','Y','','','E','a','b','v','g','d','e','jo','zh','z','i','j','k','l','m','n','o','p','r','s','t','u','f','h','ch','c','sh','shch','e','ju','ja','y','','','e');
  4.  
  5. function translit(name)
  6. {
  7.     var to = "";
  8.     var len = name.length;
  9.     var character, isRus;
  10.     for ( var i = 0; i < len; i++ )
  11.     {
  12.         character = name.substr(i,1);
  13.         isRus = false;
  14.         for ( var j = 0; j < rusChars.length; j++ )
  15.         {
  16.             if ( character == rusChars[j] )
  17.             {
  18.                 isRus = true;
  19.                 break;
  20.             }
  21.         }
  22.         to += (isRus) ? transChars[j] : character;
  23.     }
  24.     return to;
  25. }
  26.  
  27.  
  28.     function convert()
  29.     {
  30.         with ( document.forms['reghost'] )
  31.             eng_name.value = translit(
  32.                 first_name.value + " " +
  33.                 middle_name.value.substr(0,1) + " " +
  34.                 last_name.value
  35.             );
  36.     }
RAW Paste Data
Top