|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14327
- 金币
- 2449
- 威望
- 1647
- 贡献
- 1397
|
这个脚本对你可能有帮助:( c0 D( u0 l8 B2 i
<script language="javascript">
: F( g* e7 |$ n7 H5 M4 @function IsDigit(cCheck)
* R$ x0 t$ o! c& x# ~1 S { 6 E: s8 c8 j/ U- A: x
return (('0'<=cCheck) && (cCheck<='9')); # B# z' c4 f3 `- y$ S
}
8 o$ C; ?: g! N
: p( n$ L% M3 A4 E6 B" K% R: F3 |function IsAlpha(cCheck)
* B' Q( L2 N1 @2 b { ' Z+ s5 |2 Q' O
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ! p1 _3 ?, N) q8 q
} , P a( I) V0 z# S* K2 H9 {
" @. N8 m( ~ E$ {" L
function IsaNull(cCheck) 7 w. ^! M& Y3 T: I4 d
{ - x) o; G- n4 a# w" e# G
return(cCheck != " ")
$ }2 Z1 T- D5 w: L* R } ( v8 N7 e% a" n
: F; ~8 h0 X) h$ M/ F. ]
function checkform()
( \& b+ F5 J, _- E" `4 E" h{ / \1 |4 W; g4 K* X/ S
id = document.sform1.id.value; 5 L/ X3 P) Z9 Z/ X: f' g
if (id == "") 1 @ }- R) y1 h- K9 |
{
5 x( l7 O5 K5 q9 y" `1 B, S alert("请输入注册名"); $ \7 d; S2 I w1 h
document.sform1.id.focus();
4 z* R! C7 F( X$ n2 S1 u return false;
; F& D+ E# K8 L r4 @% V" l } 8 ]6 w% a8 I( z6 u) _9 S6 _
& g9 ~) u2 v. T6 r+ ~# ~ for (nIndex=0; nIndex<id.length; nIndex++)
' D: j4 d q) n. G. ] { : j! U3 H' S4 J: c! a Q) `
cCheck = id.charAt(nIndex); % A$ e4 Q# j, j3 w& F
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
" [" R% ~9 d* M- ?8 Y { 7 F. W- _1 Y; L8 d
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 6 k0 s6 I/ D4 A8 o8 o6 Z! t
document.sform1.id.focus();
( Y$ Z3 Q+ E* D" a+ ]$ X return false; + I: [( f& x2 `
} 5 k D9 l- F1 C5 I& O% q6 b3 D
} " c( H/ ^6 d" s c0 E0 K# ], u6 X
chineseid = document.sform1.chineseid.value; : V& V; C; m1 C/ U
if (chineseid == "") $ b3 @* x/ b& M, W5 w
{ ' R( G$ W: k0 i! c K
alert("请输入中文昵称");
) h W6 I0 {" I, b( x# ~7 ^ document.sform1.chineseid.focus();
+ \, Y3 }* L+ Z6 }2 O f return false;
& ]( p1 L# J3 R' P }
: q; P' v( Z& [# e password = document.sform1.password.value; ) E1 g6 x& q/ `+ R" `
if (password == "") 3 }, H0 H$ K- r0 a. v N
{ # a9 A% H2 ]: E! [
alert("请输入登陆密码"); 0 M7 M! E, Q) X
document.sform1.password.focus();
4 w+ c, `8 u: i0 Z return false; & C2 M2 Y6 n0 Z w3 g
} % A6 g* q8 Z/ o
password1 = document.sform1.password1.value;
/ n" z6 J* {8 C4 ~. ^* } if (password>password1) ( h" K V! G: A0 n4 u' G# [$ l3 g
{
) u4 ]- b- H! }$ K$ c- @ alert("重复密码与登陆密码不相同"); 9 i2 O- r* N. A+ n- \
document.sform1.password.focus();
! B( Y! k0 T% t! `; f' N+ @ document.sform1.password1.focus(); 8 H! ?$ R7 B( E+ X7 Z- _* M
return false;; ]6 f8 S _& P: t7 D' [
}
2 e& H, w, `& oif (password<password1)
: g h) J3 t' O {0 c! \, s Y. l& N5 S; Z
alert("重复密码与登陆密码不相同");
! Z0 K a6 i8 M# s/ V document.sform1.password.focus(); , F6 m% l0 f. h: b# U( w3 V! i0 J
document.sform1.password1.focus();
3 f. q1 X% v+ B/ E% u1 Y& b8 J return false;; y5 P; l# U) M1 M: x9 @, n
} 2 d( X* W& C( X1 Z4 s. x
if (document.sform1.email.value == "")
$ T+ n7 A# s0 z0 j( @ { X# _; V1 A- H1 M+ Z
alert("请输入您的E-MAIL地址"); , x! M6 G1 B b
document.sform1.email.focus(); 5 M3 T/ m: x% w: a
return false; ) Q4 D c; |' y6 ~& T
}
, w0 ]8 S/ z! E% x8 A. B
) I) Q( n) r# m7 e7 P' R- y email=document.sform1.email.value; $ b6 `$ q {3 a0 T" u( k2 q' j
emailerr=0
4 a- W+ P* I' F. x for (i=0; i<email.length; i++)
/ v8 W( G2 v: ~$ P# H { * M! ^+ G. V: t( J8 V- r. h; l
if ((email.charAt(i) == "@") & (email.length > 5)) ; P! A- p/ s# s& r1 L
{ " ?; b4 m, o1 M& c1 f. j) ^
emailerr=emailerr+1 $ \ s/ s7 q2 C! ?* E0 S
}
" _( P9 `; V! R; s }
. F# H3 W' U/ T" b$ M1 q5 z if (emailerr != 1) + e2 {8 j; w/ E
{ + j$ Y/ t8 E6 a/ J0 E8 {
alert("请输入正确的E-MAIL地址");
6 A1 B2 o( @& e/ N- K/ C document.sform1.email.focus(); : B4 `9 b2 b: y' {
return false; ; N2 U* z Z* y+ F- h1 w; X/ U
}
' j4 r5 }; y3 m8 J0 p " b( w$ C7 v) o
if (document.sform1.checkask.value=="")
4 a$ J! |! y2 J8 g7 o { % v7 U+ I+ l& I. m, S
alert("密码提示问题不能为空"); 4 @/ L( x, Y7 h* c
document.sform1.checkask.focus();
& N, g, K' W1 d* w5 W$ m( R return false; 8 M" N K: k8 \) Q) M! t) S% q
} 9 L v1 O6 }# s/ G* {3 n
if (document.sform1.checkans.value=="") 8 j. T: R. V' w. S9 t+ Q: G" W
{
( F4 A9 j W8 v( f! k alert("您的密码提示问题答案不能为空"); 1 G. x. t9 h4 X' {' F1 R+ Y
document.sform1.checkans.focus(); 2 \2 R$ e6 K$ l1 c' I
return false; 5 E$ B, t+ {" u' t0 O. a
}
" H/ Y5 X+ w: P2 H1 } return true;
, D* w9 K, A1 y7 D0 P/ ^: j
V, @0 Y, U7 O7 H3 V} ) A1 H2 j1 A, i$ F& i( e7 y- A
</script> |
|