|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:! J5 ]( R! h" e
<script language="javascript"> 9 Y, D1 w2 E2 N5 N4 U$ M) P
function IsDigit(cCheck)
- ]! \. W- u" @ b/ A { ; i7 W h7 K- }1 s2 R! f, w
return (('0'<=cCheck) && (cCheck<='9'));
/ O& X. h* t$ I1 G# }# U* Z }
5 g/ O0 G( v: ^
~8 n7 H4 n' }* w1 M6 Qfunction IsAlpha(cCheck) 8 P/ A, Q' v5 z
{
( ~9 J" ~- Z3 h return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
$ Y/ |$ t2 V3 T) ~8 D } ) n% |2 C( r/ B2 |/ Y+ j' T
8 b" z+ m0 P- Z3 R7 H' W9 N
function IsaNull(cCheck) - S5 w+ }% @/ M' e
{
' O) k$ }, e$ K1 [5 }9 J return(cCheck != " ") ( r4 e( \9 F! F1 x3 d" t) U3 o4 {" O
} / W6 U2 ~' ^; f8 a$ _+ q. d
( v, }$ `, ^- O" r2 r
function checkform()
$ U5 `) e K6 R; k3 n5 c{
" D" w6 S }$ x* p7 j4 D/ F id = document.sform1.id.value; - U% K* ^ c' y5 p; Z! U U' y5 x
if (id == "")
$ B0 D: \6 X* ` W { ) \6 k8 U: [8 g2 E2 C8 n
alert("请输入注册名"); 7 u! @+ K( N# D( q+ E* @8 f
document.sform1.id.focus(); ! V X" F) |, [. k# h$ K% `
return false;
( t9 t4 D5 D( ~' i( }$ H7 u( t1 ~' I* @ }
5 F* d* V0 O+ u) L) B
+ y: [0 m0 d" i+ @: L4 y; e) } for (nIndex=0; nIndex<id.length; nIndex++)
5 R: t% q7 ]4 D' v& N7 N { - C, X$ G& v( N) p/ c
cCheck = id.charAt(nIndex); $ ~2 ~) v8 B h3 t
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
- r6 S" ]5 C/ c/ m3 x% ^4 k {
5 a' E# t7 Q* a+ b alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
9 @: b! T* z \% Y) X) `; O; r document.sform1.id.focus();
& Q! {& O ]3 j# L( F return false;
2 @) f( k, y0 D# h1 c' k& W! x } 8 Y+ [7 \7 o! @
}
+ F: c/ s0 u7 y, e) ` chineseid = document.sform1.chineseid.value;
1 \# J/ H5 B; a) j2 [5 Y0 Q& l if (chineseid == "")
7 g, h( ?9 U& `0 d/ i$ R, E {
' z/ ]/ w7 O$ U. Z; l# f# q alert("请输入中文昵称");
$ ]7 v" _7 L) V' N, O8 h document.sform1.chineseid.focus(); " P2 F# l! P: \9 V: S/ k
return false;
& \# R9 S9 u' j8 y: [ }
V& I! H. i0 I' ^7 [( d password = document.sform1.password.value;
" t% g2 v4 [0 W) j% l+ S+ A, D if (password == "")
+ O" e- g9 _6 C ?# D7 h- _ {
1 c2 ]& e- U" E" a alert("请输入登陆密码");
; ~$ M; G5 r+ w% j document.sform1.password.focus();
) r7 u8 V3 q' m% P return false;
/ F# r7 ^0 K& \+ K0 A }
+ t, O" ]! g* `% k" e9 U password1 = document.sform1.password1.value;
7 j, M3 J* X& e4 I' z if (password>password1) * K" y9 I8 M+ _
{" A. V1 [, V$ s H5 Y6 _+ V
alert("重复密码与登陆密码不相同");
8 O/ ~6 w7 U& v) ~2 a4 W8 F) `4 D document.sform1.password.focus(); 8 b J7 t3 ?/ D7 s1 D6 A$ X, g
document.sform1.password1.focus(); - M4 O( \3 l' L: B7 D
return false;0 O5 @3 A3 l8 t# ^( ]
}
0 Q" u+ G* x: ?& C0 ^' sif (password<password1) " E2 i. N+ o6 g( f, u% D
{
6 K/ a& u6 J+ v# X% G alert("重复密码与登陆密码不相同");
( Y6 X: K- |+ ? q0 ~6 l& g+ [ document.sform1.password.focus(); , \! r) Y M- S2 [
document.sform1.password1.focus();
+ E8 Z& n1 S2 g' Q6 R* ^' M return false;0 O% b$ X+ i" T4 x5 `& G
} : h: _* g8 ~1 K, M: Y" o# n
if (document.sform1.email.value == "")
+ @" N0 k# K6 L1 O& D {
. U" U1 G0 p4 j- u* x! ? alert("请输入您的E-MAIL地址"); & k- x4 e: f9 [) H/ f
document.sform1.email.focus();
% A5 q2 y1 O3 o3 P return false;
9 R8 I& x, h! [0 ` } S$ o, z$ X; f4 c3 ^7 P
) M2 g( Z ~+ M. o6 a0 z
email=document.sform1.email.value; 0 T5 o9 ?' A# Q$ L
emailerr=0 * E1 K4 z Q( ~& d0 o
for (i=0; i<email.length; i++) 3 A3 n f: G' C& q% [6 U
{
& j) u2 f9 E- E% t/ V/ F if ((email.charAt(i) == "@") & (email.length > 5)) 9 G/ ~4 [ U9 i
{
: c* F9 t, N& i, ^; ~ emailerr=emailerr+1 ! e( V4 u8 e+ _2 ~! l' y' b
}
* @+ s3 r3 _4 \ }
# h1 C, z: S# W$ N& [( T- K if (emailerr != 1) + V, N3 f7 p+ `
{ 0 e8 ^) ]' ]- Z% k, @6 h
alert("请输入正确的E-MAIL地址"); 7 o6 r' U5 g p' f. [% L8 E" Q
document.sform1.email.focus();
* O0 t' G2 N% v' ~7 O& A% X return false; : q+ a9 @$ u- R' T2 e9 a! a5 u1 k
}
* A5 F- M/ S/ L" _( M% ^
" X/ N9 }" ? j8 k& W if (document.sform1.checkask.value=="") 5 G9 s; ]: T: @4 \. _3 F3 E
{
/ w9 h+ h& G* F1 L8 m5 N; U& c8 N alert("密码提示问题不能为空");
3 f) H7 s B% l7 h document.sform1.checkask.focus(); 4 F0 B3 b8 x/ R( l5 L. k: |
return false; 8 U/ m4 u% ?% O; Z5 l" j: g' N9 \$ Q
} # G1 B) k: ?6 t6 X B
if (document.sform1.checkans.value=="")
* Z M" G8 x _' g { & ]" Q- C8 {0 R: Q, M4 l
alert("您的密码提示问题答案不能为空");
3 K" V, W( i9 Y3 Z: ?& {( ]& `5 A; ? document.sform1.checkans.focus(); 4 T% N! U: Y0 h2 U
return false;
0 C0 T/ W) D( v4 r% {+ B) Z% ?3 [' Y }5 Y- F- M+ b) g7 q* ]1 x$ [
return true;
& N4 k; z- y% R9 |
: n, n* l4 R6 K& p} u6 ~; n" Z9 Q8 [# N R) @1 m
</script> |
|