|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14417
- 金币
- 2494
- 威望
- 1647
- 贡献
- 1442
|
这个脚本对你可能有帮助:) Q$ L. T0 F# S( F3 d- k9 I
<script language="javascript"> , |2 ^0 R L$ |+ w
function IsDigit(cCheck)
$ { p* y) n: p1 G4 M* s5 ] {
) j. T2 I) p1 [; O3 E6 N$ c return (('0'<=cCheck) && (cCheck<='9'));
" ?6 }, E5 d8 M }
& ]8 @0 X6 u! q
/ b+ @* f6 y- t' t9 v" d) M6 ifunction IsAlpha(cCheck) 8 f9 `, f8 K5 z+ u
{ 6 s, r, x1 B1 \ h3 |# @7 Z) }
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ! l' ~. E- o$ G9 ?- j$ m
} 0 r# U5 c, |' O4 m' c
; ?" [* e9 O: Y Y$ W- l4 @function IsaNull(cCheck) 1 N7 Q# G# Q( d; m% ~; ]& `
{
9 r4 R* s5 `/ t0 }4 ?: N2 I5 w return(cCheck != " ") " k7 k& M9 n2 [: R' a5 Y
} " `+ j* b$ H& d! T% p) ]
0 q9 W5 ]( h [6 s# f/ E, ?8 T3 Dfunction checkform() 8 E" x5 w/ R1 i- X
{
' o% ~8 j8 |8 B9 L; y# s- j id = document.sform1.id.value;
# V/ m7 _# G w- [* h' R' {! ?+ s. v if (id == "")
7 _* r" z7 e3 ?, ?2 z { % C! c6 d4 q8 p" I; _, A/ |5 H
alert("请输入注册名"); , H9 d# F x2 j- H) r! j7 ?
document.sform1.id.focus();
) f8 W. x% S' [7 D return false;
) R, b% Y$ q, g% d D9 v/ W } ) V" P, y8 c; X& L; H' F+ n
' l' Y5 w8 Q6 O( ]0 N$ ]4 Z6 } for (nIndex=0; nIndex<id.length; nIndex++) / @/ ~/ X/ v2 q ^' W a
{
' Q5 y( R) G) x* T$ J cCheck = id.charAt(nIndex);
$ p5 U* ]* t+ p/ b: a. Y if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
1 t0 E" L3 I' A$ d% d {
- L4 ?' B) l9 v3 E+ d3 {; C# E- D6 K W alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' l3 x0 N7 s' q document.sform1.id.focus();
! d2 Z# S( ?0 c l& _, |7 m6 U1 Z% p return false;
" I3 x- L4 ]' H0 Y }
( V2 q/ M$ L7 y* m# y1 S }
) n3 j* I) ~! y6 C: C chineseid = document.sform1.chineseid.value; $ c! t% J0 Z6 ~. g( T4 b" O
if (chineseid == "") ' ^9 Q2 a7 c5 C
{ : q2 v* J6 {7 x
alert("请输入中文昵称");
2 l6 d9 |) x7 r# a document.sform1.chineseid.focus();
8 w' a4 ]$ C6 J2 f$ Y return false; + X5 I/ i0 {6 w4 t! _. \; q
}
, a \$ m$ Q* b6 m/ y# |; W password = document.sform1.password.value;
0 N" `! N3 j X6 n [0 i if (password == "")
x8 e. C0 ~8 T8 @) E+ ] { 4 b5 k0 ]* E! f6 @
alert("请输入登陆密码"); " M; |: j7 b% G3 y
document.sform1.password.focus(); ) L3 m( s* h" i. r
return false;
4 r% g* n+ Y$ I x4 f2 [ }
$ v7 }/ x8 \1 v) x password1 = document.sform1.password1.value; . R5 }: m# l; X8 j4 W
if (password>password1) b0 `3 b* R* ~. ?
{/ x( U$ o. z; Y0 T
alert("重复密码与登陆密码不相同"); 4 y$ }1 l2 g# W
document.sform1.password.focus(); " X9 l/ S5 E( D5 L) |6 S/ G
document.sform1.password1.focus(); - X1 [$ V$ ^; p" @: E* e8 H
return false;) i ?8 N% R# R9 k, f" G1 X
} Q2 b! T: p6 Y% r( D
if (password<password1) 7 Q% G0 H( N( j" v! |+ ^
{. g+ i3 e. f9 @3 v9 U: ~9 r$ M
alert("重复密码与登陆密码不相同");
6 k7 u' C% K$ G document.sform1.password.focus();
5 B; ^4 ^5 j$ R5 V document.sform1.password1.focus(); * \7 D1 ?. S' K' z: Q# ^) O
return false;( }3 z: D; s9 A+ B2 i
}
# D) i; C& A; L7 G' ^ if (document.sform1.email.value == "") 7 R5 \* K+ M8 G
{ - m4 b& z8 X W/ z$ ~* z9 w. j2 Z
alert("请输入您的E-MAIL地址");
- }. ?5 A2 r/ F; o; j- t" e; Q% T document.sform1.email.focus(); ' l( t* N0 V; n+ V* T
return false; + r( P5 h9 C2 c2 V" v
}
2 o# Z8 w! r" E( V# }/ {
8 E( l4 X' ~; ?) ^+ @& u email=document.sform1.email.value; + B4 N# a6 Q ]& O! V/ s$ S8 L9 Z
emailerr=0
6 P6 h5 {" Z) ^2 m for (i=0; i<email.length; i++)
f6 A" c1 S |) D7 ?( C3 z, R- { {
; X N! b9 S% e% ^* |6 f+ Y if ((email.charAt(i) == "@") & (email.length > 5))
|$ r' Y" s. N' l, K5 T {
9 C6 \& I0 T0 l+ h emailerr=emailerr+1 ! |$ A6 V3 n8 S( G
}
( m" d% U6 C3 A } * N* b! S1 D; B9 |) A) u5 }
if (emailerr != 1) 0 X- y" U" u- z, i+ W# A
{ 7 ]3 c+ e) f! s) v# [* ]
alert("请输入正确的E-MAIL地址");
$ _7 n! O, W) R! b% k9 A4 Q document.sform1.email.focus();
; B" m# P) C' ^4 h* c' M return false; " M# j$ G- {, @ T, p
} # d" \7 f6 ^/ Y: Y) d/ r: f+ Q+ v/ i
3 R3 s' G" I* p) {4 F
if (document.sform1.checkask.value=="") ; z6 |. @8 S. b8 s: v4 i# i! V
{
" X7 s- `9 i, y alert("密码提示问题不能为空");
( M8 \6 V9 o$ P1 X; t3 M document.sform1.checkask.focus(); ' U/ r" F+ m+ X" `! H# z5 _. v# K
return false; - y% z, J3 q! k- M, {% M: B: n+ _
}
( o3 ?6 V5 L& a; a8 n' x$ i. `( h if (document.sform1.checkans.value=="") . @; q. K! W! E
{ ( c* Y. A3 C, q$ e" h9 g) _
alert("您的密码提示问题答案不能为空");
9 B/ ?. U# E# R3 Y document.sform1.checkans.focus(); 4 ?5 R( ^0 R1 O2 o4 K2 d' C
return false; ; Z6 g# k6 y, l( ]' k
}- K; K. q" {+ z& @% X- }
return true; . d" |; e e D9 d% A6 V# }: @0 P
1 ?, }$ k* p0 W% P# a4 @
}
" D3 s: |1 K0 {5 q G+ X, @</script> |
|