JS 判斷

上一篇 / 下一篇  2008-09-19 14:36:39 / 个人分类:項目筆記

Ruby CommunityxA*Wfz1P
 /********************************************************
2yC\'Q-oMrt Wt0 *【名 称】onFocusChangeBGColor
Y1f;v {"fOp0 *【概 要】入力フィールドの onFocus イベントで呼ぶRuby CommunityHq3c"M!yI4ha
 *          現在のカーソル位置の色を変更するRuby Community5e!] K$|@+b|(d(q
 *【引 数】 なし
*uEC%H~*{1{u }g"m0 *【戻り値】 なしRuby CommunityA2H|6Y'I;Y
 *********************************************************/Ruby CommunityJp0@"i k3L`V
function onFocusChangeBGColor(e)
byb"c ?|/I(y3J0
d|0F.?O,I9b0   var elem = e.target || window.event.srcElement;
,x:W9P.r&L#e~u.t0   if(elem.type == "text" ||
4{8D ekzyq+X0   elem.type  == "textarea" ||
eF@X u#Ub0   elem.type  == "checkbox" ||
*OJN\4^LP V/O*IU0   elem.type  == "radio" ||Ruby Communityf Mg[)C-ZZ
   elem.type  == "select-one" ||
da-c%}v0fNb0   elem.type  == "password"){
BJPFg~n @;a8`0   elem.style.backgroundColor = "#66CCFF"; //水色
}&_P8YK4~&V?|0   if(elem.type  != "select-one"){
po`4]^-skP0    elem.select();
/B[u.zD-| a S;^yQ0   }Ruby Community.E#Mj[9vy&F/_
   }Ruby CommunityS6cq_&It$o
}

 /********************************************************Ruby Community7a6r tM3S1f;I\?
 *【名 称】onBlurChangeBGColor
{KXOW0 *【概 要】入力フィールドの onBlur イベントで呼ぶRuby Communitymq1z?BX$` x8`V
 *          現在のカーソル位置の色を元に戻す
'bS$_0u4K5Uc0 *【引 数】 なしRuby Communityyb@Q*Z}
 *【戻り値】 なし
dldtBg0 *********************************************************/
S&W:bz@.sc0|0function onBlurChangeBGColor(e)Ruby CommunityN0{'JHg0s7R+M&\
{Ruby Community N;\"@o xC6R
    var elem = e.target || window.event.srcElement;Ruby CommunityiXu~3Hyf
    elem.style.backgroundColor = "";Ruby Community dbl&darQb
}Ruby CommunityL?0FB1M(KD
 /********************************************************
s-]'T.m'o-[ n0 *【名  称】OpenWindowRuby CommunityY ?0wQ/K
 *【概  要】新しいウィンドウを開くRuby Community F7P4C UGk
 *【引  数】p_str        アドレス名
6J]3|"U?xH5v0 *          p_title      ウィンドウタイトル
7m%H-LO)PL c$\%E0 *          p_width      ウィンドウ横幅
ad-V8I8K XI1a0 *          p_height     ウィンドウ縦幅
'uf(^'qMp0 *          p_x          画面左からの位置
i8mwP}0Kn"T0 *          p_y          画面上からの位置Ruby Community*w9|3My\pO @
 *          p_scroll     スクロールバー表示/非表示(yes/no)Ruby Community3Fe/I1b9N1m?U
 *【戻り値】なしRuby Community#wd,D n`(P)N V9q/B
 ********************************************************/Ruby Community'W$X+I;}/rm
function openWindow(p_str, p_title, p_width, p_height, p_x, p_y, p_scroll){Ruby Community0] ?ny6m;Su"yx~
 if(win!=null){
n@~/W+_1~w0        win.close();
t"Ve[m:~0    }Ruby Community2H;HF8^7c]M
    win = open(p_str,p_title,"width="+p_width+",height="+p_height+",left="+p_x+",top="+p_y+",resizable=no,scrollbars="+p_scroll);
;r Kv%nH'|0    if(win!=null){Ruby Community,` m^8g8{#v*C/]L
        win.focus();
p0sGG-VsO%b0    }Ruby CommunityMK~K ~A
    return win;Ruby Community]jyR0b }C|
}

 /********************************************************
+mD\p(d.x \!V.bL0 *【名 称】chkNullRuby Community,v9@8xk!m,h9D%U
 *【概 要】入力された値が空白かチェックするRuby Community$MCZ;Og)U'ia4s
 *【引 数】p_itemValue  チェック対象の値
&s(SX7]5}0 *【戻り値】正常:TRUE  異常:FALSERuby Community-e/`\T c g
 *********************************************************/Ruby Community YEf'R5O;Y~#w|"W
function chkNull(p_itemValue)
R q;rl8ZSX0{Ruby Community,r`"R+bk*@x h:{
 if (trim(p_itemValue) == "") {
(n:tYI*g"W2jHY"W\0     return false;
;Fh+L8m)d7wn$U0 }
c(c$HA'me!c0 return true;Ruby Community ss8s W\.W
}

/********************************************************Ruby Community'P$Un[q Sh
 *【名 称】trim
$S d6uDp\0 *【概 要】前後スペースを削除する
HKh\!LL3v9e0 *【引 数】p_itemValue  チェック対象の値Ruby Community]3TF{9bgj
 *【戻り値】正常:前後スペース削除後の文字列Ruby Community3X*}^4|/T+i6Jf.@p
 *********************************************************/Ruby Communityr6a2hdL|? {
function trim(p_itemValue)
'i6nM5G]0{
h s#p2d?4Y7l6J0 var str = p_itemValue;
l!N)Yw u?4B0    str = str.replace(/^[ ]+/, "");
YRZ0F9`}S{$@A0    str = str.replace(/[ ]+$/, "");Ruby Community g j2_.pR)AR
    return str;Ruby Community AFn)Y(|+X f
}

/********************************************************Ruby Communitym2{f(?b0u:D.w
 *【名 称】chkLengthSmallerthanRuby Community#o%i(u,xHxI
 *【概 要】入力された値が指定されたバイト数以下かをチェックするRuby Community&@&b+@+n\w@
 *【引 数】p_itemValue  チェック対象の値
d ]#\[$^u$`I sP0 *          p_size       桁数
W9REX+C t$S0w^0 *【戻り値】正常:TRUE  異常:FALSERuby CommunityiA)Xy7e P(XI
 *********************************************************/
@#tg-p"b~ V0W:A0function chkLengthSmallerthan(p_itemValue, p_size)Ruby Communityd7p7U1B|
{Ruby Community.ZX:} pa[ ga
 if (p_itemValue == "") {Ruby Community oc/UK/qQ%J Z@)I
        return true;
? H,m"L{}4M0    }Ruby Community7l'Dg+Sbe"A2f*Z7~
    if (getByte(p_itemValue) < p_size) {Ruby Communityx%D q*L-xH%e0~,U
        return false;
"iQ8b'Xm0I-EB)M0    }
N/i.R*Kt6Y ^0    return true;Ruby Community8J fNC%bO w u|\
}

/********************************************************
/DIrr)nw0 *【名 称】chkLengthGreaterThan
Fb6KbOu0 *【概 要】入力された値が指定されたバイト数以上かをチェックする
2yl4JhxJ&wg0 *【引 数】p_itemValue  チェック対象の値
|T-k_z oC?0 *          p_size       桁数Ruby Community;{V H,_PF-\,e NQ
 *【戻り値】正常:TRUE  異常:FALSE
g7k m#|N)C X[0 *********************************************************/
;oY-p:KzU~4~ o0function chkLengthGreaterThan(p_itemValue, p_size)Ruby Community N#Ak m^z LH
{Ruby Community!D3~2Db/H
 if (p_itemValue == "") {Ruby CommunityB;R:o`:TuZ)N
        return true;
Z!rS$f6c0h0    }
,T1M;Ti)Fj{'si0    if (getByte(p_itemValue) > p_size) {Ruby Community7j:G*\ |g#?j)cC!o
        return false;
-B-oHLa AN~0    }Ruby Community"d"`/|0o\7p+CM
    return true;Ruby CommunityX)v}"U*?
}

/********************************************************
4i"R\2T+dDP0 *【名 称】chkLengthRange
kr]w)SS#]5} eOA0 *【概 要】入力された値が指定されたバイト数範囲かをチェックするRuby Community8F/x(V |!RI D
 *【引 数】p_itemValue  チェック対象の値
X#mB9R?o.l0 *          p_sizeFrom   桁数FROM
2yuLR/XL YD0 *          p_sizeTo     桁数TO
7zK2^ a9}*Tv2@0 *【戻り値】正常:TRUE  異常:FALSERuby Community9[pb/xZ;\p~\5p
 *********************************************************/
*T8eC%d?0function chkLengthRange(p_itemValue, p_sizeFrom, p_sizeTo)Ruby Community%H/r1W'N*RPe
{
4a h3d ju M0 if (p_itemValue == "") {
tB5Kh8} O0        return true;
4O,\4j EBI6lL3RVN0    }Ruby CommunityU L|#BT}E,go
    if (getByte(p_itemValue) < p_sizeFrom || getByte(p_itemValue) > p_sizeTo) {
N)T:ePh/B[w5l0        return false;Ruby Community5dUP2v6fHO
    }Ruby Community:P(S.^?cMK`P
    return true;Ruby Community0u~{$q v
}

 /********************************************************
]@~T_i0 *【名 称】chkNumRuby Community$zk)S} V
 *【概 要】入力された値が数値かチェックする
&GE_*i'BL0 *          (0~9で構成されているか)
Kg;PU#b~&s~g0 *【引 数】p_itemValue  チェック対象の値
@iUyj{f0 *【戻り値】正常:TRUE  異常:FALSE
Z^%^!])S6Vafz~0 *********************************************************/Ruby Community,P%F"_%g$B7P
function chk_Num(p_itemValue) Ruby Community7mc/Uv5A@@
{Ruby CommunitydwdocE6~
    // 入力を認める文字を定義する(ここでは数字)
x4YPn PnQChK@z0    var kStr = "0123456789";
;L xXG/u3S fmb0    if (p_itemValue == "") {Ruby Community9V:o$fgk X?
        return true;Ruby Community+v Q!j6t7vB
    }
6KRg1mBgt @0 Ruby Community5Z^$X+j:k~
    for (var i = 0; i < p_itemValue.length; i++) {
+S/hW3?Mq0        if(okStr.indexOf(p_itemValue.charAt(i)) == -1) {   Ruby Community9b(^!E*Hf-Rc/U
         return false;
Y'n/M zg6of*QHA0  }
4Hks n4H0    }
TbK"N n T0    return true;
6w)eK s3X*@0}

 /********************************************************Ruby Community0s5~L0r|dc)U
 *【名 称】chkNumberRuby Community8u0o3t A)?,Oi
 *【概 要】入力された値が数値かチェックするRuby Community H([}jv
 *          (0~9と.)で構成されているか)
+Eg3m)i$q&p0 *【引 数】p_itemValue  チェック対象の値
0| C } | ZE d6M k%Pll0 *【戻り値】正常:TRUE  異常:FALSE
r2|lW*}KD[E1Qh0 *********************************************************/
x*~,Db:^UhmU0function chkNumber(p_itemValue) Ruby CommunityYpl z_Y
{
,~X&C;q CD0    // 入力を認める文字を定義する(ここでは数字)Ruby Community:T$h7e ynvOUJ
    var kStr = "0123456789.";
R wK+A:K `'vUL0 var value;Ruby Community!SnuEj Bam
    if (p_itemValue == "") {Ruby CommunityZs(td ?9SU
        return true;
"Z QhP&BBM1d]bj7X0    }
5fOm;Z9T+n7hS0 Ruby CommunitykcKMw T$t jW
 value = p_itemValue.split(".");Ruby Community#N7Qs1e2j:N9B
 if (value.length > 2) {
A4z|JPj4f0     return false; Ruby Community!JSiy6IUk
 }Ruby Community ]#gw'u a%[
 Ruby Community }sBX.oZSc-`
 if (p_itemValue.substring(0,1) == '.' || p_itemValue.substring(p_itemValue.length, p_itemValue.length - 1) == '.') {
"z$RP4b o(w0    return false;
gi1kL5Gs0   }

    for (var i = 0; i < p_itemValue.length; i++) {Ruby Community#M2~uJ;XEv
        if (okStr.indexOf(p_itemValue.charAt(i)) == -1) {Ruby Community%wQJr'}K$S c
            return false;Ruby CommunityC9Z)x4`SvD%qG,\
  }Ruby CommunityP[XPu#p*m
    }Ruby Communityo DAFL9oi ~ex)v
    return true;Ruby Community3yq,r7r.O3ge.S
}

 /********************************************************
6_+GQG\,n$[`2P0 *【名 称】getByteRuby Community#@2Z X.e-~^
 *【概 要】文字列のバイト数を取得する
-KM&S"n&e'Q,A0 *          全角を2バイト、半角を1バイトとしてカウントします
o4_`e8o*e0 *【引 数】p_itemValue  チェック対象の値Ruby CommunityY ^VuR
 *【戻り値】取得したバイト数Ruby Community O{,vC5C
 *********************************************************/Ruby Communityc}!x~3tQc.Ei1E
function getByte(p_itemValue)Ruby CommunityH I8n%\,ga-E1L
{Ruby Community]-g3U-HF:fgGK A9eY
   var count = 0;Ruby Community'k E!gvl
   for (var i = 0; i < p_itemValue.length; ++i) {Ruby Community|3M.~b? OJ'T
      var sub = p_itemValue.substring(i, i + 1);
f"x!^3}$G3IB5O0      // 全角の場合2バイト追加
"Fyp9ov0[z0      if (chkIsZenkaku(sub)) {Ruby Community;RPH?Gge mB
          count += 2;Ruby Community{l \A0`f |
      } else {
e!['Yqt7hND0          count += 1;
L'p-hDmmav0      }Ruby Community(F]x9eekA w
   }Ruby Communityt;]q?xY r6wu8w4E
   return count;
)m^e7p [u(K0}

 /********************************************************Ruby Community$`Vz.Kf
 *【名 称】chkIsZenkakuRuby Community+hK&b#mwGr
 *【概 要】全角であるかをチェックしますRuby CommunityJ{/CJ1Nb;P6C { w
 *【引 数】p_itemValue  チェック対象の値
0^:ARm%XO0 *【戻り値】ture : 全角   flase : 全角以外Ruby Communitybrc'_Ts0vje:A
 *********************************************************/
8X(|\E0bk6H0function chkIsZenkaku(p_itemValue)Ruby Community ]Q{f|Y?^
{
0l5j'yK}ivNZ/B4n0   for (var i = 0; i < p_itemValue.length; ++i) {Ruby Community,bLV?e8u s
      var c = p_itemValue.charCodeAt(i);Ruby Community8MZA+z/WDs7H$c
      // 半角カタカナは不許可Ruby Community(ymZ ` jj
      if (c < 256 || (c >= 0xff61 && c <= 0xff9f)) {
!sh-W.R+J/A AK c0         return false;
I9K#P1FFDT6X|0      }
"}X6h xu0   }Ruby Communityed#u_*Xs#Hs j@2a
   return true;
0N ~0V5c [y^I0}

 /********************************************************
5@`Jf$o"p0 *【名 称】chkDate
{ E.G0S @$}4}X0 *【概 要】入力された値YYYY/MM/DD形式の日付が存在するRuby Community&U6|jRd7_!u
 *          かチェックする
{3] _5qfH0 *【引 数】p_itemValue  チェック対象の値Ruby Community t|j tJ%E?6B}|+Di
 *【戻り値】正常:TRUE  異常:FALSE
jZ qcs |`@]j0 *********************************************************/
.g0| I%Sy*VP}C0function chkDate(p_itemValue)Ruby CommunitylW0{ k%z1aRd
{Ruby Community'iCq8D y/qA`$bDE
    var r = p_itemValue.match(/^(\d{4})(\/)(\d{1,2})\2(\d{1,2})$/);
-g0v ^7ZX:DFs0    if(p_itemValue.length != 10){Ruby Community3j(j(FZ A \]|5j
        return false;Ruby Community p){B(D*qh
    }
\\:d}rk)N1J`0    if (r == null) {Ruby Community5F5tzjmot9k
        return false;
Y3YF%fY(? GU0    }Ruby Community\ G;Q"@$bAM ]2k/Hl0t
    var d = new Date(r[1],r[3]-1,r[4]);
3qzgqf5n] a0    if (d.getFullYear() == r[1] && (d.getMonth()+1) == r[3] && d.getDate() == r[4]) {
zmmg!n Lc/|0        return true;Ruby Community Y_/i8l l Bq7XRVO
    } else {Ruby Communityf$F W$O7b/X9i XP.]
     return false;Ruby CommunitySyN-W.U
    }
b!I0hN;~x0}

 /********************************************************Ruby Community8G(R _:~'CWi8i`(WP ?
 *【名 称】chkYYYYMMRuby Community/Uh2T+L ed*RB(t+S
 *【概 要】入力された値YYYYMM形式の日付が存在する
z3SK4~N0 *          かチェックする
Y%w.Nan!g0 *【引 数】p_itemValue  チェック対象の値Ruby Community7MkQ2Rh_ \3~
 *【戻り値】正常:TRUE  異常:FALSE
T6i$v P1? D^9v-hC0 *********************************************************/
cct9u7H\i0function chkYYYYMM(p_itemValue){

  if(p_itemValue == "") {
"H [2F)O"zW0      return true;
g9b?$E$A8}$\a0  }Ruby Community.]"vYR]f;L
    Ruby Communityni8X_#m4D1t
  if(p_itemValue.length == 6){
!{Y$e }o P0      p_itemValue = p_itemValue.substring(0,4)+ "/" + p_itemValue.substring(4,6) + "/01";
l-u J:Y \E(o|WA0  }Ruby Community4c x)p-t!H,Eu_5xUuq
  var r = p_itemValue.match(/^(\d{1,4})(\/)(\d{1,2})\2(\d{1,2})$/);    
KP9?;d5D q"RNp0  if(r==null){
:uZ?[3E)C`RL0   return false;
!o4?h9y1S\%U:Qd+j0  }
3j9vB r;s0  var d = new Date(r[1],r[3]-1,r[4]); 
V/b&is3I4I#I,a2K0  if(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]){
1s$LT;m2x3nq~!w xp0   return true;
!H't-g2W/m V xA\"V8q0   }else{Ruby Community&v0f0}t;{5aV~
    return false;Ruby Community*AMss#T
   }
T$Um4u!V p,x F&K:q0}

 /********************************************************
4gEb1g1[J0 *【名 称】chkFormatDate
?v!f b-Tt9e0 *【概 要】入力された値YYYY、YYYY/MM、YYYY/MM/DD形式の日付が存在する
'^'tp5V!o D.gy~0 *          かチェックする
6H F+[;z5S*J!^9m0 *【引 数】p_itemValue  チェック対象の値
"\t9P5\\/a\0 *【戻り値】正常:TRUE  異常:FALSERuby Communityw|X F)U/|6ol.D^!R
 *********************************************************/Ruby CommunityA*QY6NyB4X
function chkFormatDate(p_itemValue)Ruby CommunityV|2Oh:[S3BS
{Ruby Communitys7|]@:ul
    if(p_itemValue == ""){
VU%^ }4d"P$o0        return true;
V`M}-|#I `!f*Q;?0    }
H oqYB/A1La0    // YYYY/MM/DD形式の日付Ruby CommunityKx SA7?!L
    var r = p_itemValue.match(/^(\d{1,4})(\/)(\d{1,2})\2(\d{1,2})$/); 
,L$e{!Nfc;c0    if (r == null) {Ruby Community [hT8X-\/`S"p6u `d
    }else{Ruby CommunityT L nF's-V"?Z
        var d = new Date(r[1],r[3]-1,r[4]);
&l.oSY8^qEG0sM/r0        if (d.getFullYear() == r[1] && (d.getMonth()+1) == r[3] && d.getDate() == r[4]) {Ruby Community6N!Yh,x#Ei2Za
            return true;
kwf:l)p!bgCa0        } else {Ruby Community@kZ,h7L? e9k
        }
:s.d%?mSw0    }
1L/Jbdq/x0    // YYYY/MM形式の日付
8fxRIav5X/f0    var r = p_itemValue.match(/^(\d{1,4})(\/)(\d{1,2})$/);
)H%q UW2x L9L0    if (r == null) {
GZT5uh&F@ j+]0    }else{
&yL"Td-r0        var d = new Date(r[1],r[3]-1);Ruby Community%ggM8N$B7l
        if (d.getFullYear() == r[1] && (d.getMonth()+1) == r[3]) {
7U-tubr&[W0            return true;Ruby Community2U ?/mRyb
        } else {
'`y?YN:U0p T0        }Ruby Community4@ @F}!]!N
    }Ruby CommunityG|g.m%r9u2L
    // YYYY形式の日付
7f { F9sCH&L T0    if(p_itemValue.length == 4){
h0} ~p)\ F.K3GZ0        var r = p_itemValue.match(/^(\d{1,4})$/);Ruby Communitywf7P[-dwT
        if (r == null) {Ruby CommunityN5|t"p bSy1h[a
        }else{
"p%?@ o A0            var d = new Date(r[1],"01");
5{"t u2m!]B0            if (d.getFullYear() == r[1]) {
bYA2q|2w4A+x5?K0                return true;Ruby CommunityPX*VN!Ob
            } else {
*dU.`:AGB0            }
HxCcfT0        }
3ns,O AzA%S(zz0    }

    return false;
QL){ew/M5{$CD0}

 /********************************************************
;^.X T6F7gH0 *【名 称】chkEmailRuby Community!Lqs_2|:BM
 *【概 要】入力された値がemailアドレス形式
c/T,U%T{Z'{`RZ0 *          (xxx@xxx.xxx)かをチェックする
4z8Q"buF7h0 *【引 数】p_itemValue  チェック対象の値Ruby Community7yf5T k^0H~ L
 *【戻り値】正常:TRUE  異常:FALSERuby CommunityS|)[c\8JC
 *********************************************************/Ruby Community-Lzs7cIW0l`y P
function chkEmail(p_itemValue)Ruby Community L*UV2j u3z9OPe:b}
{
B ~,A-Z7n t ps`h0 if (p_itemValue == "") {
x.n2\E[o0        return true;Ruby Community-UV[i+O%P
    }Ruby Community)^C.z'n)czO y
    var check = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
${&Y P\Te-U0    if (p_itemValue.match(check)) {Ruby Community e9[)s rSy$D
        return true;
sNXyG rRs0    } else {Ruby Community R0a?7X!egV
        return false;
2ka4[Q r'{0    }
c#J \5]?FT!Tt[M0}

 /********************************************************Ruby Community0|V"v0BY^
 *【名  称】chkYubinnoRuby Community7s `7@M&y3z@'kN;Y
 *【概  要】入力された値が郵便番号形式かをチェックするRuby CommunityK(?b)o)hT5\KF\
 *【引  数】p_itemValue        郵便番号
x~e/C2Se0 *【戻り値】正常:TRUE  異常:FALSERuby CommunityjOjcG
 ********************************************************/Ruby Community.zJv.rO`k
function chkYubinno(p_itemValue) {
0b/P)j/e P%j0    var str = p_itemValue;Ruby Community7gS5n7_F
    if(str == "") {Ruby Community5OXb"Y3O#W;o;U$T-t
        return true;
7@;Bl;P8L'`H0    }
[OzDw_0    var check = /^\d{3}-\d{4}$|^\d{7}$/;
4}E#DT*R(Rn0    if (str.match(check)) {Ruby CommunityS IJc `z ~j1^8P
        return true;Ruby Community'?h6HY Y/C8T
    }else{
+wD.g`4yTu9z0        return false;
*w+nBT-l ?0    }
r6J[9@d0}

 /********************************************************
.kD5\(zgJ-g-C0 *【名 称】chk_Mobiletelno
jS B*Xy#i&X Ep0 *【概 要】入力された値が携帯電話番号形式かをチェックする
e'~_\QT1M$g8LD0 *【引 数】p_itemValue  チェック対象の値
z@Jx%H9|R4ac0 *【戻り値】正常:TRUE  異常:FALSERuby Community }&z~7oN W|k
 *********************************************************/Ruby Community(Dv DYIR
function chkMobiletelno(p_itemValue){
4}Aeia0    // 入力を認める文字を定義する(ここでは数字 + (-))
/UhY I"I0    var okStr   = "0123456789-";Ruby CommunityW?o!?Q
    var str = p_itemValue;

    if(str == ""){
-_ d5}M |0        return true;Ruby Community4C2S:\DG}s
    }Ruby Communitym+XRl+|@}$N
 
3QXi bG@W0    for( var i=0; i<str.length; i++ ){Ruby Community5rW?P$r$ihr P
        if( okStr.indexOf(str.charAt(i)) == -1 ){
"]E,t:e&X/i$b9W~0            return false;Ruby Community5g~3LF&^;T `M_
        }
'M'h&h0w^$J{0    }
3aQYp*i0    return true;Ruby Community Hoy|{ ^;pU
}

 /********************************************************
{$G;wG!s5kq'r0 *【名  称】showMsgRuby Community^K3Va/mZC? o9z
 *【概  要】詳細メッセージRuby Community(s.`!B.p;P$pr
 *【引  数】p_arrMsg       メッセージ Ruby CommunityK \.`!oBc:L
 *【戻り値】なしRuby Community4VIC,k+C,|
 ********************************************************/Ruby Community)|y r1JN(H&K
function showMsg(p_arrMsg) {Ruby Community3Q#BjRwss
    var strMsg = p_arrMsg[0];Ruby Community[-bSI!MK\
    var intCount;Ruby Community hw%^"nB~6F
 if (p_arrMsg.length == 0){Ruby CommunityVrIuFGA i
        return; Ruby CommunityJ/Y/[4ta)dOwB,Q
 }Ruby Community4m;e!x+s5b2^P$uh|B
 Ruby Community^vPX~j9@:{
    // 確認メッセージRuby Community7n,iCY a.wHV
 if( p_arrMsg[0].indexOf('?') != -1){Ruby Communityq&k)^6zUx
  for (i = 0; i < p_arrMsg.length; i++) {Ruby Communitymp D&Ee9Ze X
         strMsg = strMsg.replace("{"+i+"}",p_arrMsg[i+1]);Ruby Community1Z A}ul
     } 
;i`kT v x&u0  return confirm(strMsg);
-TY1L;M.h0}{SA`0 }Ruby Communityb]:V7d PcK)i
 
+IZW"L_Sa*S0 // 入力エラーメッセージRuby Community3B B0h[jB;}g&A
 for (i = 0; i < p_arrMsg.length; i++) {
H1Y+r1|#v0     strMsg = strMsg.replace("{"+i+"}",p_arrMsg[i+2]);Ruby Community*Lw`-^3C,u
     if(p_arrMsg[0].indexOf('***') != -1){
_o$dVw%SKr9a0        intCount = parseInt(p_arrMsg[3])/2;Ruby CommunitybK"I+j.w$L
        strMsg = strMsg.replace("***",intCount);Ruby Communityo UZC'M#CMyL:Y
     }Ruby CommunityZ3E ?6A8z'O
 }

 window.setTimeout(function() { document.getElementById(p_arrMsg[1]).focus(); } , 0);

 if(p_arrMsg[1].substring(0,3) != "sel" && p_arrMsg[1].substring(0,3) != "ddl" && p_arrMsg[1].substring(0,3) != "btn"){
A-U%j Zzf0  window.setTimeout(function() { document.getElementById(p_arrMsg[1]).select(); } , 0);Ruby Community.w6Oh |,D"r
 }
2x P![#IR"~0 
8] j W Q `E)r0 // メッセージ
3OXI9m6uE0 alert(strMsg);Ruby Community'n'E?1M E [u
}

 /********************************************************Ruby Community"c tm%K ?x&QaL
 *【名  称】showKensyuWindowRuby Communityu2L4H7m I3KML
 *【概  要】研修選択サブ画面を開くRuby Community d@ VZV7@B
 *【引  数】p_KensyuCode 研修コード
"W2FMx"BNEY0 *          p_KensyuName 研修名
o!\(s)Zd I*z0 *【戻り値】オブジェクト。Ruby CommunityB2j9}'k6s/D
 *          プロパティに以下の値を登録している。Ruby Community&C WK:l(eQ_PC^9l
 *          p_KensyuCode 研修コード
7qT'K*qb4P1G%G0 *          p_KensyuName 研修名
)i8}gq3Y0 ********************************************************/
9W%cf*D I$]0function showKensyuWindow(p_KensyuCode,p_KensyuName){Ruby Community\"qLKR+@
 var strUrl;Ruby Community\7c3H?Ja ?
 strUrl = "../Common/Syain_Info_Sel_Kensyu.aspx?";
9JI$R8a1C6s P0 
JI HltT5m#w0 strUrl = strUrl + "source1=" ;
!na!T)HG/X0 strUrl = strUrl + p_KensyuCode ;Ruby Community.Y:o1@}$q%Z
 strUrl = strUrl + "&source2=" ;Ruby Community1Pl8Mq@2Hm2C
 strUrl = strUrl + p_KensyuName ;Ruby Community^t-d!ZWs \t
 
X%K4yV*i0nb*lO0    // 開く
,QM y t!T*jLl0   openWindow(strUrl,"","440","350",(window.screen.availWidth-400)/2,(window.screen.availHeight-300)/2,"no");
'Y6r p6s C0rh0}

 /********************************************************Ruby Community x,xy-?RK3a\
 *【名  称】showSyozokuWindow
V#eO8M?*P/cJ0 *【概  要】所属選択サブ画面を開く
8E,R%coN^L}y0 *【引  数】p_SyozokuCode 所属コードRuby Community-eYzy)X I
 *          p_SyozokuName 所属名Ruby Community0~\fLYON i
 *【戻り値】なし
j4I:W }M'm Oc1T1g0 ********************************************************/
A^z9hL0function showSyozokuWindow(p_SyozokuCode,p_SyozokuName){
B*?lH*w^7R"I0 var strUrl;
G&[7[u&r0 strUrl = "../Common/Syain_Info_Sel_Syozoku.aspx?";
Fnra1K0 Ruby Communityz5W%{I3xH
 strUrl = strUrl + "source1=" ;Ruby Community#xwO Ng3qoC
 strUrl = strUrl + p_SyozokuCode ;
O$g.?|p'P'j0 strUrl = strUrl + "&source2=" ;
2\$~ Af^0g6R O0 strUrl = strUrl + p_SyozokuName ; Ruby CommunityC}8BN:M.a9@2l.FUL
    // 開く
/f_a%w*MDi)I0   openWindow(strUrl,"","440","350",(window.screen.availWidth-440)/2,(window.screen.availHeight-350)/2,"no");Ruby Community6JH&} ?"uQ` E+?
}

 /********************************************************Ruby Community8}qRdA5J
 *【名  称】showSikakuWindowRuby Community!e-_3["x2c!b#c
 *【概  要】資格選択サブ画面を開くRuby Community aw2p-QGbS'R
 *【引  数】p_SikakuCode 資格コード
*nLO#A~d0 *          p_SikakuName 資格名
t!J3U5rm(Zm V|/pG#U*S0 *【戻り値】なしRuby Community"p&@[0z1B)Cq
 ********************************************************/Ruby CommunityAPYt:s0j*`4Gn
function showSikakuWindow(p_SikakuCode,p_SikakuName,p_HidSikakuCode){Ruby CommunityGi,V f.X8L~X
 var strUrl;
@eN#Z8bbqq0 strUrl = "../Common/Syain_Info_Sel_Sikaku.aspx?";Ruby Community7xZ+I Ri qk
 
%uu&`g2bCF$M0 strUrl = strUrl + "source1=" ;Ruby CommunityNeF%\%[kI,w
 strUrl = strUrl + p_SikakuCode ;Ruby Community+N(\+L LkL#IUFT
 strUrl = strUrl + "&source2=" ;
PFv"ry;l j5xp+g0 strUrl = strUrl + p_SikakuName ;
$g[7}0Cin2a0 strUrl = strUrl + "&source3=" ;Ruby CommunityX`U&k sI
 strUrl = strUrl + p_HidSikakuCode ; 
&ot%ch,A-[Z}0    // 開く
FVU$N A_3XN0   openWindow(strUrl,"","440","350",(window.screen.availWidth-440)/2,(window.screen.availHeight-350)/2,"no");Ruby Community1S@:YZ.yY"aY
}

 /********************************************************Ruby Community2@,f1yh3X1rX
 *【名  称】HTMLDecodeRuby Communityn QK ? m1T$|*Mn
 *【概  要】コーディング処理
4^.NHB,l~0 *【引  数】p_strEncodeHTML 処理内容Ruby Community4g!l0}!nP,~"u:S0v
 *【戻り値】innerText/textContentRuby Community4g0H!?Q1H(P[
 ********************************************************/Ruby Community4A"? ^/YC"{e4f
 function HTMLDecode(strEncodeHTML){Ruby Community#bA'oT~{!}
     var div = document.createElement('div');Ruby CommunityJw^6|R6k6i
     div.innerHTML = strEncodeHTML;Ruby Communityw$Y jE? M0jzM0{$z
     if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1){
#}f y oqEN#TP0         return div.innerText;
q'~@;qX yC0     }else{
?-@l6N&vR)@!m0         return div.textContent;
l&I(b-u.X6}b3S0     } Ruby Community}Yvl&K9K
 }Ruby Community2pge!\7DB g l&z/@+~
 
Z ~P}'t8Ul,mSf0@0 /********************************************************
3{:f|1xuCzV0 *【名 称】formatNumber
!|C x%]Kp` ^"?0 *【概 要】書式変換Ruby Community^U.GZ~2t$q"bX
 *【引 数】strValueRuby Communityq.vNfj }*Fv
 *【戻り値】value
;P v(eF)F0 *********************************************************/Ruby Community6uc5L:d&m0I _ y
function formatNumber(strValue)
/r4t'xi"RLi2RWM7bU9C0{Ruby Community4A2XBU1['R0n3t\2e
    var format;
x v`}6r&iY\$hgm\0    var value;
;nwaTp](u)X5p0    format = "";
Z}O{1i\ N"J`H0    if(strValue == ""){
H_X5R+R6N0        value = "";
gCX7KN0    }else{Ruby Community+dN'cN(s5s5bF)X
        value = strValue;Ruby Community.w3lj-F.x7B5_
    }

    while(-1 != value.indexOf(","))Ruby CommunityuO5e Y TI
    {Ruby Community5mWK``x
        value = value.replace(",", "");Ruby Community~^9{r4P
    }

    if(0 == value.length || isNaN(Number(value)))Ruby Communityv%[jc,|3M'uN4sC9E
    {Ruby Community v I{c M~"W1V
        return value;
%W)Qf6NX$A4}.|9yI0    }
1GT&s&vh E i1v0    else if(format == "default" || 0 == format.length)
Kv Wd1q~l f#u0    {
&~ @ ZEW s3Jh0        format = "#,###";
2O G Z|G6Q#["S0    }Ruby Communityn4Vap?3f M.I
    ret = "";Ruby Community B9Y1jekK
    // フォーマット部解析

    pointPos = format.indexOf(".");
*L6K_ K*q9B]t'_R0    if(pointPos == - 1)
W] wQ_:UM&Efu(k0    {
Y5kiL3`-W)Jyg0        pointPos = format.length;Ruby Community%Qpg#?i&gI4| w{
    }
b ^*Ho~3XN0    // カンマ区切りの間隔Ruby Communityk+Vd2X5RW7Ry/i
    commaLen = pointPos - format.lastIndexOf(",") - 1;Ruby Community+qe;i;SK^+_Qq
    // 小数点以下のレングスRuby Community3Pd6M?z
    underPointLen = format.length - pointPos - 1;
o&P N6GO{2^`V0    // 書式変換
5fs2|sv(R?0    kigou = "";
/\(`O(o)t+x+G;M0    if(0 == value.indexOf("+") || 0 == value.indexOf("-"))Ruby Community8g~$O#UTK6MA d?
    {Ruby Community&U#[%XTr \uN!g
        kigou = value.substring(0, 1);Ruby Community*X~+^3Uru+p&j
        value = value.substring(1);Ruby Community'|oJ-Zuy
    }Ruby Community2k3MU,C]um g*f
    valueN = Number(value);Ruby CommunityCtI(hr4]u$wQ
    value = new String(valueN);Ruby CommunityjQb#hen
    separator = "";Ruby Community:a f8@/|9B[#|_
    {
SGO&h}1K7T8sL0        len = value.indexOf(".");Ruby Community:Za sv{,Cjt-x'@
        if(len == - 1)
,`8P5klh$fM%r3R0        {Ruby CommunityJ^%W0?y\(Kx4YX
            len = value.length;
l:s:K/U R9G-c.x0        }
C a_Z ? QA0        separator = "";
;O8AF0r6K(Ft u0        ret = value.substring(len);

        // 小数点以下の処理

        if(underPointLen > 0)Ruby Community-pO,^txeW
        {
l0[q5E1K,k0            if(0 == ret.indexOf("."))Ruby Community-]5VEiN
            {
}IE&^5U [1h0                ret = ret.substring(1);
F(CE:u%n0H&o0            }
0]RL/ys'Ox0            while(ret.length < underPointLen)Ruby Community8m*]%OK Y
            {
rBR\]s}0                ret = ret + "0";Ruby CommunityUFxUb;oR@2\
            }
UfTW$a M3ar0            if(underPointLen > 0)
%Z EQC(htU0            {Ruby Communityh;t0}c1f P;ch
                ret = "." + ret;
7cDd6u%V3F} ~[0            }
JuN3k0{/Q_O0        }

        // 小数点前のカンマ区切り処理

        while(0 < len)
p g Y^ Gx0        {
i)I!q%Jc[0l0            ret = value.substring((len - commaLen < 0 ? 0 : len - commaLen), len) + separator + ret;
c\ ^)[S }M0            len -= commaLen;Ruby CommunityMtg+i*v*X
            separator = ",";Ruby Communitys"q7e} J9t+z
        }
&p-j:XHA0        if(0 == ret.indexOf("."))
a/F|y;[#s"ig0        {Ruby CommunityW*_FzY(J[
            ret = "0" + ret;Ruby CommunityDP._"] _'N7^+} o
        }Ruby CommunityF)^$Sym2gW
        else if((ret.length - 1) == ret.indexOf("."))
AE$A&zwy1i P0        {
9WwaCH$\g0            ret = ret.substring(0, ret.length - 1);Ruby Community2m"l1Zj2j4Y
        }Ruby Community0g J4J7bpU6m
    }
Ak0|Z|ZA$X%l0    value = kigou + ret;
)b XWb7E/A0   
0|:r?$`.A"z3Wx0    return value
o8}#e#Q,U;{T0}

 /********************************************************Ruby Community`.F6s Nng
 *【名 称】TabToNextRuby Community)I9sd4| oNZ d,l
 *【概 要】Enter変換Ruby Community[(C1@,w8Lg6v:Lq
 *【引 数】e
z5w1Q#m,yHS4h_0 *【戻り値】なしRuby CommunityTv/y T?TdP
 *********************************************************/Ruby CommunityvN*?G9X3_]
document.onkeydown=function(evt){
&w6J$\)A,}C&E0   var isie = (document.all) ? true : false;
mNJl_ k|)O0   var key; Ruby Community*|2[u~`2]7_n6B}j
   var srcobj;Ruby Community C.Kd AI8Y]
   if (isie) Ruby Community B!U'L4o}7@p E'C
   {Ruby Community^U SZ9p_ NB
     key = event.keyCode;
cZu:tI4H |+SM0     srcobj=event.srcElement;
/j u6v`-t*G1E4p0     }Ruby CommunityApjN n)Wtb
   else Ruby Community|+[!ezb(I-Q
   {Ruby Community*Q,Q$mh.[d']
     key = evt.which; Ruby CommunityBj9`7jol
     srcobj=evt.target;Ruby Community0b8P_ L1||8{ {M
     }              
R-O6g7@2R9N%qk$d0     if(key==13 && srcobj.type!='button' && srcobj.type!='submit' &&srcobj.type!='reset' && srcobj.type!='textarea' && srcobj.type!='')                 Ruby Community"_p,bf&fH
     {
C S*~C)Y0       if(isie)Ruby Communityo`3t Z5i s*@%u
       {Ruby Communityf E ~#LB
        event.keyCode=9;Ruby Communityx1e6UOS-~x
       }
0SZ9eQ-t*f0       elseRuby Community+q U7Tr9B
       {                       
wCY:Q8D"^nF0         var el=getNextElement(evt.target);Ruby Community Dh[x2q/d3mt.h
                 if (el.type!='hidden')
V(^#h)X%fn]"wfM0                    el.focus(); Ruby CommunityO[ B"N#Y
                 elseRuby Communityz k"Pmv?!g
                    while (el.type=='hidden')
~d1E\'s;P0                       el=getNextElement(el);
x'K+c.o2p-E3waz0                    el.focus(); Ruby Community1v7O%i4M ^i
                 return false;Ruby Community'?Wd9D~^x8A.To
       }
1wCD(xX(},w7]SE0     }Ruby Community4|N@ekO
  }               
|9d7Dbuv KG0function getNextElement (field) {
"d7@'V"yYE(@m3H0   var form. = field.form;
a i.@\/G*j}0   for (var e = 0; e < form.elements.length; e++) { Ruby Community_ y~N1t4wI
     if (field == form.elements[e])Ruby Community5p VXM S;C7jg
         break;Ruby Community I*Q!QVyU"W
   }
;q*K8x,HG/Fx o1f0   return form.elements[++e % form.elements.length];Ruby Community'N3w-J-\:Q(`q
 }
T\1n`|$j0 Ruby Communitysu{fg&U ]
/********************************************************
7|nb3c2z"J9l0 *【名 称】chk_CharAndNum
5oXJ6fg-C-]0 *【概 要】入力された値が半角英数字かをチェックする
.N~D A0K3R.i y0 *【引 数】p_itemValue  チェック対象の値Ruby CommunityrRw["]0Qj.vN$Z
 *【戻り値】正常:TRUE  異常:FALSE
ow;{O\/Qh&}-io0 *********************************************************/
4xUMs Hz0function chk_CharAndNum(p_itemValue) {Ruby Community8~.Qi;{8V_Q \ jv(?
    // 入力を認める文字を定義する(ここでは数字)
&lLe5wLWy0    var kstr = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_';
B"aY4ii7[x0    var str = p_itemValue;Ruby Community2_~}-h'zyJ
    var i;Ruby Community?zQ2j-N tP)U
    // 半角空白カット
9yw ly+z5@C`C6b0    str = allReplace(str," ","");
[$BP%Ljt)Ww0    for (i=0;i<str.length;i++){Ruby CommunityAc-_%e3LO
        if (okstr.indexOf(str.charAt(i)) == -1){Ruby Community0y`TH/A o
            return false;Ruby Community5`8hm)k7p4U7u
        }Ruby Community3B{YI_8y"r,f}
    }Ruby Communityux7Uyp
    return true;
ge er\0}

/********************************************************Ruby Community+ac*Jd%j!w
 *【名 称】allReplace
Wk,c@!t7?0 *【概 要】text中のsTextをrTextに置き換えます
[#X8XDU&U'F4C0 *【引 数】p_itemValue  対象文字列Ruby Community0\a{4y0B)AKnf
 *          p_stext      置換対象文字列Ruby Community?W nS0_s(}
 *          p_rtext      置換文字列
1CHO|;f2\)u |x0 *【戻り値】置換後の文字列Ruby Community;f:}*z~;bLSn\z
 *********************************************************/
~w'j3g@'Fd)~P0function allReplace(p_itemValue, p_stext, p_rtext) {
\0j4M2S'D0  while (true) {Ruby CommunityI.`:Nq*J5P ~
      var dummy = p_itemValue;
Yy)`8}bDS7[$eS0      p_itemValue = dummy.replace(p_stext, p_rtext);
9qrfl7O0~0      if(p_itemValue == dummy) {
4h-D W5^d3D'H T0          break;Ruby Community2g_KJ:I{9J4|
      }
P}K V{d0[ L0  }
(p*Q'Qwi wm-D0  return p_itemValue;Ruby CommunityX5{'@QL.s2s FWQf7g
}

/********************************************************Ruby CommunityVB!c.{)C+o1l` z
 *【名 称】CalendarRuby Community~4S5H7fq)~3X7TC+P
 *【概 要】日本語表示に置き換Ruby Community i+V#v@5Z6qK,fge
 *【引 数】Ruby Communityx$CH|&t$K#y3{
 *【戻り値】
8U\8r,Uj+Lm0 *********************************************************/Ruby Communityjh H lVS
 function Calendar() { Ruby Community'I(MhR@$O
    var f = AjaxControlToolkit.CalendarBehavior.prototype._performLayout.toString();Ruby Communityrw?Z]@"Z7r
    f = f.replace('"MMMM, yyyy"','"yyyy年 M月"').replace('"MMMM d, yyyy"','"yyyy年 M月 d日"');Ruby Community!As:l&j*\ ^6l(N)Mi3L
    eval("AjaxControlToolkit.CalendarBehavior.prototype._performLayout = "+f);
n%~@c nz9d0}


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2009-07-05  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 42
  • 日志数: 19
  • 图片数: 1
  • 文件数: 1
  • 建立时间: 2008-05-09
  • 更新时间: 2009-03-23

RSS订阅

Open Toolbar