  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
这个脚本对你可能有帮助:
! C- Y J i5 Y8 y. H7 @7 ]# T<script language="javascript"> 9 a" ]' s9 F. l1 {
function IsDigit(cCheck) - H- V( K) p4 |4 d
{ 6 c! n6 R" m V% I% M
return (('0'<=cCheck) && (cCheck<='9')); " c# J- `5 G3 O
}
' O& z1 j# s/ {( M7 E
, ~, n4 q6 L H5 R- Gfunction IsAlpha(cCheck)
4 J. [* b" p: ~ { + A* W5 e- B* u; |8 d4 I n+ K
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 4 i* `: N4 m4 D; ^$ \
} ! z+ b9 k" W. j/ A) J1 T4 ]" _3 n
! i8 X) \9 M% g+ E1 b7 X# H+ H# i& gfunction IsaNull(cCheck)
2 K1 b8 ^ o% q, R { . c S! M! p4 Z7 p
return(cCheck != " ") % ]) a! k' ^# j& R0 _& T
}
! r& ]% p/ Z( S5 E+ D ) ?7 Z9 ?4 \; K R, b
function checkform()
! k3 r2 J% l+ T Q4 V{
. ?- |1 S- _3 i7 ]. d, I id = document.sform1.id.value;
; b, A" G2 F# ]8 ^: P, ^ if (id == "") * u( z; d) \5 @* I' y4 w0 P2 F
{
, ? f8 K0 s* p& N" U. S% { alert("请输入注册名");
{# s/ B, F% s* r, T7 b$ Z& E8 ~+ @6 }) z document.sform1.id.focus(); 3 o% g9 S! q: p& l
return false;
, F. V" N* A/ H2 v9 r } 4 U# L" f. h3 e/ c! p7 \
1 b9 {# Z) ?. y2 Q4 J+ y! Q1 T& W) j for (nIndex=0; nIndex<id.length; nIndex++) # T4 v5 |6 @" [+ {- k
{
' _4 `5 @* {3 H0 u/ x: d) _ cCheck = id.charAt(nIndex);
* x0 S- {% k6 C9 l7 d if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) ! o! K+ v, W) S
{
0 D2 A# V) S# U H, S! { alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
/ L; i- P: J" ]; e3 |! Q document.sform1.id.focus();
9 K( `' [% \" W2 O return false; 1 ^. R: a& [* Y& `( l
} . ?: S* A# D+ s+ }5 ^1 V
}
* J: \( j/ L) `7 ]# }& z: N chineseid = document.sform1.chineseid.value;
. ?) c) ]2 p2 E/ _4 h/ K% C) ], C if (chineseid == "") 8 A: Z" V3 \3 g2 j+ m
{ _3 H, t: q, {& n3 ^, A
alert("请输入中文昵称"); * f6 _( c- m1 j, r C& |4 U9 l
document.sform1.chineseid.focus(); 6 Q5 v; d9 Z, ~% P6 c$ b( g5 I
return false;
8 {) g7 `: k- z( ]) k) N0 c S }
: z5 E* ? _" l* M k password = document.sform1.password.value; : h/ D! k) w) r. e1 {1 n
if (password == "") 5 Z6 s3 Q. r5 M# P& n' n' u
{
& r) s- b! f0 P( f5 m& g, K0 Q alert("请输入登陆密码"); - J0 X; I- F# }9 f: F# B( I+ a+ G' x
document.sform1.password.focus(); , S# a9 z8 K0 o' K- y, d3 K2 ^
return false;
! k' l/ o" f# i! Y( C( h } ! z+ P4 s% |" q6 u
password1 = document.sform1.password1.value;
7 C1 P& p y) O' I- c3 B7 b! K if (password>password1) " c( f3 k0 x; r& ]: D
{
4 {$ q( N1 f+ Y; A alert("重复密码与登陆密码不相同");
3 m6 M3 ]5 h0 B# {1 a6 D# S8 \ document.sform1.password.focus(); 8 R9 X) w* U; m
document.sform1.password1.focus();
. ?8 R; a- F! S& y) j$ J0 l& d0 i return false;
6 G5 I5 W8 `8 K( I, ~4 V2 h2 H! o, q }
! s; S1 z$ A2 H% g- [if (password<password1)
) M5 [/ M- ~7 H! } {
" m+ Y% s" m- l# ?! O3 } ? alert("重复密码与登陆密码不相同");
; B& j- G3 x. V, h, j. U document.sform1.password.focus(); & Q4 I* {/ m) T; d1 `7 n8 W: S% y
document.sform1.password1.focus();
$ [! u6 f7 D* p- _% m7 j return false;5 x8 ~/ i. s8 l7 L; K2 @$ M
}
- _. [' X! @7 M if (document.sform1.email.value == "")
! L0 z- q# X! _ {
7 d. M6 n+ A+ f! `3 Q' C alert("请输入您的E-MAIL地址");
3 F4 v( {7 y% e document.sform1.email.focus(); ; p+ g' K/ Q0 n6 \5 V6 G# L6 f1 i
return false; : b& g7 G1 \: e
} 0 U" m3 W1 h# [# h5 Q; o! e- J/ v
* ?$ \. w ]! e. [
email=document.sform1.email.value; ' A. w( W; ?7 d% b U- U% D" W; z, e
emailerr=0
8 |1 D. `9 }- f) S' ` for (i=0; i<email.length; i++)
# s l- _; V1 \" w+ T( \ { , @5 x8 l% m+ `# W6 Z+ @7 I
if ((email.charAt(i) == "@") & (email.length > 5))
4 u8 T9 h) k4 e4 {* j { 1 r: X+ S4 j# S* f( l
emailerr=emailerr+1 7 E6 @( X$ I4 k" r3 I
} + r0 O4 P8 s$ x [9 N7 H
} ! M P0 h6 ?- x# r1 w
if (emailerr != 1) : E" j- j9 ^+ J2 s, \ w
{
4 U6 W C( g! ^; [* P9 f alert("请输入正确的E-MAIL地址"); 0 C- W4 S8 `8 k9 V% g8 R% ]; a
document.sform1.email.focus(); 6 Z; U1 h% y# J& d5 Y8 i- M6 \, F% `
return false; 1 w+ z0 b4 ^# L5 F: j* R& J( R
}
0 f3 X+ e _" ?0 F2 k 0 }8 H% p8 Z ~9 p* \
if (document.sform1.checkask.value=="")
$ P" ]4 l' F1 v) A( T# K { : L2 D3 i; c1 L; o
alert("密码提示问题不能为空");
$ ?8 W7 @0 L8 B: C0 ~+ @ document.sform1.checkask.focus();
3 k9 B! Y8 f+ f/ y# P' ~; r S3 W return false; # {* @; R3 s6 R, K3 z
} 2 d7 d( w7 N+ {0 k
if (document.sform1.checkans.value=="")
) p* Y7 T: \' G+ Z9 w. c- i& m: F; m5 W { $ D8 s, a( Q# L v9 u6 X
alert("您的密码提示问题答案不能为空"); * b- f. \+ u8 }9 G" d3 `9 {
document.sform1.checkans.focus(); 7 \; O% {+ W" n1 r- H
return false; 1 Z5 a% f, }5 i9 |( c; [
}& n5 m* m. K w' Y1 @
return true;
- H# k& P( V1 Z M. J" {' @ # @9 d7 f2 u: b+ U* D% F
}
# j8 Q- d- J6 v</script> |
|