日曜日, 7月 06, 2008

JavaScriptの全角、半角、カタカナ、ひながな間の変換

カタカナ⇔ひらがな/全角⇔半角変換(カタカナ対応)

JavaScriptやActionScriptで「ひらがな」⇔「カタカナ」を相互変換するライブラリーを公開しています。



フォームのフリガナを自動入力させるAutoRuby.js

    /* auto_ruby.js var 1.0.0
    * Presented by 2008 Source Create co.,ltd.(http://www.srce.jp)
    * Author Akira Yoshimaru(akira@srce.jp)
    *
    *--------------------------------------------------------------------------*/

    //--------設定--------
    var convFlag = 1; //モードフラグ ひらがな→0 カタカナ→1
    var nameField = 'name'; //名前のID
    var rubyField = 'ruby' //カナのID
    //--------------------

    var baseVal = "";
    function setRuby(nameId,rubyId) {
    var newVal = $(nameId).value;
    if (baseVal == newVal){return;}
    if (newVal == "") {
    $(rubyId).value="";
    baseVal = "";
    return;
    }

    var addVal = newVal;
    for(var i=baseVal.length; i>=0; i--) {
    if (newVal.substr(0,i) == baseVal.substr(0,i)) {
    addVal = newVal.substr(i);break;
    }
    }
    baseVal = newVal;
    var addruby = addVal.replace( /[^  ぁあ-んァー]/g, "" );
    if (addruby == ""){return;}
    if(convFlag){addruby = convKana(addruby);}
    $(rubyId).value += addruby;
    }

    function loopTimer(){
    setRuby($("name"),'ruby');
    timer = setTimeout("loopTimer()",30);
    }

    function convKana(val){
    var c, a = [];
    for(var i=val.length-1;0<=i;i--){
    c = val.charCodeAt(i);
    a[i] = (0x3041 <= c && c <= 0x3096) ? c + 0x0060 : c;
    }
    return String.fromCharCode.apply(null, a);
    }
    var timer = false;
    window.onload = function(){
    loopTimer();
    $(rubyField).onkeyup = setRuby(nameField,rubyField);
    }

水曜日, 7月 02, 2008

Frequently Asked Questions Regarding The Windows 2000 Command Processor

Frequently Asked Questions Regarding The Windows 2000 Command Processor

MS-DOS/MSDOS Batch Files: Batch File Tutorial and Reference

海外中国語雑誌

华夏文摘

Prpgramming Source Web Links

Binaryworld - Atlanta based Custom Software Development & Consulting Services (Free VB, VB.net, ASP, SQL Server Articles, Codes, Tutorials and Programming Resources)

CodeProject: The Lounge. Free source code and programming help

China Photo Gallery by Gil Azouri at pbase.com

China Photo Gallery by Gil Azouri at pbase.com