|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14331
- 金币
- 2451
- 威望
- 1647
- 贡献
- 1399
|
这个脚本对你可能有帮助:
8 |# N2 z* {1 A) V. P ~% ^$ H( ?; W<script language="javascript">
3 D5 ]# I( E- P ^1 Xfunction IsDigit(cCheck) " @" D. l8 d o/ M' q/ O; ]
{
( [: T0 W+ \8 c return (('0'<=cCheck) && (cCheck<='9')); 2 K! d% g1 i1 {
} 9 c1 a+ S: R4 K0 D
1 R9 e) H" A; W afunction IsAlpha(cCheck)
) _- s8 t0 p9 K1 q% v, T$ Z- w {
) K3 i9 _4 o( O: _$ j return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) : ^8 [% l- X" S5 j' `2 d8 @
} ; _4 \3 t3 V! W
" O6 [, S$ @( Q+ X/ @function IsaNull(cCheck) 8 d% L' L6 w1 \
{ ' _: C7 ^$ z6 q& Z; ~
return(cCheck != " ")
# }* _" t( L0 N# D0 ?. \# X1 T } ) H* s, f) |/ A# e) r
P# A' ]3 v, V5 R
function checkform()
L1 }# k9 o Z1 I{
8 X1 f5 p+ }" t2 n; S( h id = document.sform1.id.value; ! P/ G1 C2 m- [, y9 B
if (id == "")
3 n y8 Q$ _! A { 8 \& @4 J2 S) e5 }7 v5 y
alert("请输入注册名"); 6 s6 Y& J3 H$ I
document.sform1.id.focus(); 7 V1 k% R; t8 X! {! z) @ u
return false;
* k# k9 w+ `( o! y( o7 C }
) }7 w: ~. L% d4 x
+ ]. [- {5 z: H$ L9 z+ A$ n for (nIndex=0; nIndex<id.length; nIndex++) 2 A; U0 u5 S1 I1 ^
{
1 \* k7 S. z% [/ _ cCheck = id.charAt(nIndex); , W0 u0 ?4 J6 D( e3 i
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) / i5 l6 p3 r9 W( Z
{
" L7 }$ B9 K0 E' L5 N alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 6 _0 Q/ m& h& d4 r: }
document.sform1.id.focus();
) R& }, M8 R$ { return false; % J `% m0 o1 F5 Y
}
: l# F- [( j; L0 I }
# m4 ^# ]0 E: w! |0 K5 e chineseid = document.sform1.chineseid.value; 4 G$ g7 C' g5 O4 j% E" b
if (chineseid == "")
3 V' y( j, s7 N4 a5 N8 }3 E6 ~2 ^ { 6 {5 A' e- I% @/ ]: d& r0 r& ?
alert("请输入中文昵称");
5 y; g3 W# }# D9 b$ j& \ document.sform1.chineseid.focus(); 1 S. H6 _0 F. t; ~( H+ m0 F
return false;
; c+ @# J6 B" D }
' V Y* D/ _5 a* q password = document.sform1.password.value;
: l% v8 [7 [. u, v# j! O if (password == "")
/ t+ o4 ]/ h) X# O' @5 i% K {
4 m& t: x& j" `- V# z9 |+ d alert("请输入登陆密码");
; [% l y, {3 k5 P/ {$ s document.sform1.password.focus(); + B! l$ `" C- j* C5 k
return false; ! F7 B0 }8 |8 k3 |! V( ~
} - G+ i3 S* }( A: J0 ]7 y* D% K
password1 = document.sform1.password1.value;
- f% Q. G. T! [: m if (password>password1) ' \/ I4 R7 y9 [6 N$ [: L& c# d9 |" M$ d
{6 @$ ]* e. w) c) ?0 R0 j% b
alert("重复密码与登陆密码不相同");
+ R% F7 z/ u- ^: H% Z$ o document.sform1.password.focus(); ) E, w! q* I' m4 Q9 c
document.sform1.password1.focus(); : R% T1 H' ^, c" ~' `, Q3 f
return false;4 I8 ?9 k9 }1 U9 l# b* ~$ P& B
}
1 w6 ^! v2 R' R6 Lif (password<password1) 0 { L* t" G3 b2 u. k
{
0 M# M% h+ w. E alert("重复密码与登陆密码不相同");
9 k3 i1 i) |5 J+ g$ @2 h document.sform1.password.focus();
5 c( k `5 m* Q document.sform1.password1.focus();
# }2 A$ E1 V* p6 { return false;
, H, O$ A* C1 v+ K }
, n2 M/ d9 @ f' R! F; f9 B if (document.sform1.email.value == "")
+ u9 \5 [+ z+ U5 @$ {- U$ Q { , ` P- t) |* p. P: u
alert("请输入您的E-MAIL地址");
8 ~6 [ K4 [" V7 c: w1 N `# j1 l document.sform1.email.focus();
`) d- }# {- j+ Z, Q; z) [* ~ return false; ' q2 Q2 Q) }9 p# [+ a2 _0 R+ a$ h
} 3 A& Q' T+ u8 ^8 _$ B2 z& M) B4 c
0 p* j z" e: t5 O
email=document.sform1.email.value; % \" J8 D* Y9 y0 C4 `
emailerr=0 " g5 w/ w7 C* a6 l: u: H
for (i=0; i<email.length; i++) / G) p2 N9 U) x+ s( f
{
# l) E0 R1 s. _ if ((email.charAt(i) == "@") & (email.length > 5))
3 R9 {! ^# g3 _! p* E { % r7 F" Z: ?, e( l
emailerr=emailerr+1 5 q! W8 V- P! I2 T
} ; x/ \( c- U# ^; |# W6 g7 w9 I
}
9 X" g0 u- R, B, T3 d' l if (emailerr != 1)
% O2 K7 X `, n& n, c { 8 J' g9 T' e: }
alert("请输入正确的E-MAIL地址");
, {- `. S4 h0 p+ f document.sform1.email.focus(); - x/ K( t& {+ c1 l
return false;
/ t/ C* ^: z* U } . U5 F* {# l% D
* y3 m: C( ]7 L3 \ if (document.sform1.checkask.value=="")
, D+ z8 S2 X' q( U. H {
" m" O6 o0 L4 u4 S ^& C7 b alert("密码提示问题不能为空");
" d' j) G: }5 h- C) g( C5 i/ {- a X document.sform1.checkask.focus(); ! @- N1 v2 V% l. U; [4 ?
return false;
9 l* G" W2 \# W0 k+ S }
6 S& L4 s$ h2 t) B, N0 H if (document.sform1.checkans.value=="") 0 r/ Q+ y) q* \6 j" h5 j8 Q
{ + [ ]6 s" D, D3 U0 y: F, n% G
alert("您的密码提示问题答案不能为空");
) E" F. m- s4 I p2 B( n i document.sform1.checkans.focus();
! K' [& M( K6 I) [% Y9 e return false; 4 z5 g+ F, \: ~5 O$ x; r; v" \% P7 r
}& G y. \* w& D$ C
return true;
5 g H8 _% E5 f + r# j% |. @1 r* c! [) g0 y$ P$ ^$ |
}
) C; {# Y/ _0 Z+ p: {% i</script> |
|