You are invited to Log in or Register a free Frihost Account!

Random Kana table generator.

Here is a PHP script to learn Japanese Kana:
Any comment ?
Thanks and regards.

//************************ RevisionKana 2.3 - Générateur Aléatoire Des Tableaux De Révision Des Kana
$HiraB=$HiraB || (!$HiraB && !$KataB);  //At least one
$Hira1=array('あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'ら', 'り', 'る', 'れ', 'ろ', 'や', 'ゆ', 'よ', 'わ', 'を', 'ん', 'が', 'ぎ', 'ぐ', 'げ', 'ご', 'ざ', 'じ', 'ず', 'ぜ', 'ぞ', 'だ', 'ぢ', 'づ', 'で', 'ど', 'ば', 'び', 'ぶ', 'べ', 'ぼ', 'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ');
$Hira2=array('きゃ', 'きゅ', 'きょ', 'ぎゃ', 'ぎゅ', 'ぎょ', 'しゃ', 'しゅ', 'しょ', 'じゃ', 'じゅ', 'じょ', 'ちゃ', 'ちゅ', 'ちょ', 'にゃ', 'にゅ', 'にょ', 'ひゃ', 'ひゅ', 'ひょ', 'びゃ', 'びゅ', 'びょ', 'ぴゃ', 'ぴゅ', 'ぴょ', 'りゃ', 'りゅ', 'りょ');
$Kata1=array('ア', 'イ', 'ウ', 'エ', 'オ', 'カ', 'キ', 'ク', 'ケ', 'コ', 'サ', 'シ', 'ス', 'セ', 'ソ', 'タ', 'チ', 'ツ', 'テ', 'ト', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'ヒ', 'フ', 'ヘ', 'ホ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ヤ', 'ユ', 'ヨ', 'ワ', 'ヲ', 'ン', 'ガ', 'ギ', 'グ', 'ゲ', 'ゴ', 'ザ', 'ジ', 'ズ', 'ゼ', 'ゾ', 'ダ', 'ヂ', 'ヅ', 'デ', 'ド', 'バ', 'ビ', 'ブ', 'ベ', 'ボ', 'パ', 'ピ', 'プ', 'ペ', 'ポ');
$Kata2=array('キャ', 'キュ', 'キョ', 'ギャ', 'ギュ', 'ギョ', 'シャ', 'シュ', 'ショ', 'ジャ', 'ジュ', 'ジョ', 'チャ', 'チュ', 'チョ', 'ニャ', 'ニュ', 'ニョ', 'ヒャ', 'ヒュ', 'ヒョ', 'ビャ', 'ビュ', 'ビョ', 'ピャ', 'ピュ', 'ピョ', 'リャ', 'リュ', 'リョ');
$Roma1=array('a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'ho', 'ma', 'mi', 'mu', 'me', 'mo', 'ra', 'ri', 'ru', 're', 'ro', 'ya', 'yu', 'yo', 'wa', 'wo', 'n', 'ga', 'gi', 'gu', 'ge', 'go', 'za', 'ji', 'zu', 'ze', 'zo', 'da', 'ji', 'zu', 'de', 'do', 'ba', 'bi', 'bu', 'be', 'bo', 'pa', 'pi', 'pu', 'pe', 'po');
$Roma2=array( 'kya', 'kyu', 'kyo', 'gya', 'gyu', 'gyo', 'sha', 'shu', 'sho', 'zya', 'zyu', 'zyo', 'cha', 'chu', 'cho', 'nya', 'nyu', 'nyo', 'hya', 'hyu', 'hyo', 'bya', 'byu', 'byo', 'pya', 'pyu', 'pyo', 'rya', 'ryu', 'ryo');
//Mixe aléatoirement les éléments d'un tableau associatif SANS ALTÉRER SES CLÉS du tableau
function ShuffleAss($arr){
   return $new_arr;
//Associe les Kana à leur RÔMAJI.
$HiraAss=array(); for($i=0;$i<count($Hira);$i++){$HiraAss[$Roma[$i]."_H".$i]=$Hira[$i];}
$KataAss=array(); for($i=0;$i<count($Kata);$i++){$KataAss[$Roma[$i]."_K".$i]=$Kata[$i];}
$RomHAss=array(); for($i=0;$i<count($Roma);$i++){$RomHAss[$Hira[$i]."_R".$i]=$Roma[$i];}
$RomKAss=array(); for($i=0;$i<count($Roma);$i++){$RomKAss[$Kata[$i]."_R".$i]=$Roma[$i];}
//Mixe les tableaux
//Construit un tableau HTML contenant les données d'un tableau associatif
function TableAss($Data,$K2R=true,$MaxColl=50){
   $Coll=$Coll+(1-($Coll%2));//Force un Nb. de colonne IMPAIRE
   echo "<table class='".$TaCN."'><tbody>\n";
      echo " <tr>\n";
            echo "  <td><span>".$Val."<span>".$Sol."</span></span></td>\n";
            echo "  <td><span><span></span></span></td>\n";
      echo " </tr>\n";
   echo "</tbody></table>\n";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
HTML,*  {margin:0Px;padding:0Px;font-weight:normal;}
BODY    {font-family:"Trebuchet MS",Arial,sans-serif; font-size:15Px; margin:10Px; cursor:default;}
TABLE   {border-collapse:collapse; width:100%;margin:5Px 1Px;clear:both;}
TD      {border:1Px solid #6E6E6E;padding:2Px;}
TD *    {vertical-align:middle;margin:0;padding:0;}
H1      {font-family:Verdana,Arial,sans-serif;font-size:15Px;margin:2Px 0;font-variant:small-caps;}
P       {margin:0Px;padding:0Px;text-align:justify;}
A       {text-decoration:none;color:#0000CC;}
A:hover {text-decoration:underline;color:#993300;}
#KanaS  {background-color:#F1F1E2;vertical-align:middle;padding:0 0 0 5Px;}
#KanaS  labelX {margin:0 0 0 18Px;}
#KanaS .Cbox {margin:0 15Px 0 8Px;}
#KanaS .Send {background:#E0E0BE;border:1Px solid #979748;padding:1Px 8Px;}
/*************************** Classe des tableaux interactifs utilisés avec la fonction JS KanaTAB */
.DamK SPAN, .DamR SPAN SPAN     {font-size:28Px;}
.DamK SPAN SPAN, .DamR SPAN     {font-size:14Px;}
.DamR SPAN SPAN, .DamK SPAN SPAN{margin-left:9Px}
SPAN.on_    {color:#FFFFFF;}
SPAN.off_   {color:#F3F3F3;}
SPAN.hover_ {color:#FFE9E9;}
SPAN.click_ {color:#000000;}
TH       {background-color:#B3E7E7;}
TD.on    {background-color:#FFFFFF;}   {background-color:#F3F3F3;}
TD.hover {background-color:#FFE9E9;} {background-color:#FFCCCC;}
<script language="JavaScript" type="text/javascript">
//------------------------------------------------------------------------------------ Cell Click FX
var elem="TD";//OBJECT concerné:TR ou TD
function KanaTAB(){
      var el=document.getElementsByTagName(elem);
      for(var i=0;i<el.length;i++){
         //if(el[i].childNodes[0].tagName!="TH"//Pour TR
         if(el[i].tagName!="TH"                //Pour TD
         //&& el[i].parentNode.parentNode.className.indexOf("Dam")!=-1){         //Pour TR
         && el[i].parentNode.parentNode.parentNode.className.indexOf("Dam")!=-1){//Pour TD
                  this.className="hover" ;
                  this.SolOb.className="hover_" ;
               if(this.onmouseout==null && this.className!="click"){
               if(this.className!="click") {
//----------------------------------------------- Blur All Clickable Elements To Hide Dotted Borders
function BlurTAG(){
   var eName=new Array("A","INPUT");//*** CUSTOMIZE: Elements To BLUR
         var Elems=document.getElementsByTagName(eName[n]);
<body onload="KanaTAB();BlurTAG()">
<div style="float:left;"><a href="/">Home</a> &bull; RevisionKana 2.3 &bull; Click cells to see answers.</div>
<div style="float:right">
   <form id="KanaS" name="KanaS" method="post" action="">
      <label for="Hira">Hiragana:</label><input type="checkbox" class="Cbox" id="Hira" name="Hira" <?PHP echo $HiraC;?>>
      <label for="Kata">Katakana:</label><input type="checkbox" class="Cbox" id="Kata" name="Kata" <?PHP echo $KataC;?>>
      <label for="Dble">Dbl.Kana:</label><input type="checkbox" class="Cbox" id="Dble" name="Dble" <?PHP echo $DbleC;?>>
      <input type="submit" class="Send" value=" OK ! ">
   //echo "<h1>Hiragana</h1>";
   //echo "<h1>R&ocirc;maji -&gt; Hiragana</h1>";
   //echo "<h1>Katakana</h1>";
   //echo "<h1>R&ocirc;maji -&gt; Katakana</h1>";
So, what do you mean by that? Do you need any help with the above code or is it just a showcase?
Related topics
Random page generator
[c++]random number generator doesnt work
Pulling quotes from wikiquote
Paperclip for a house
Visual Basic Tutorial - Random numbers
Javascript random code generator script needed please
Simple(?) probability question
Rockman ZX Walkthrough
One Click and boom! - Random Topic
A small random survey to show sex + age influence numbers
JAVA - random name generator
Need some advertising space
Microsoft confirms that XP contains random number generator
Python random password generator in one line
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.