|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14325
- 金币
- 2448
- 威望
- 1647
- 贡献
- 1396
|
这个脚本对你可能有帮助:
- D4 z' J. C7 s# ?; h: E<script language="javascript">
2 F" X0 g; z0 L6 I. K! f8 [) y9 ffunction IsDigit(cCheck)
, ~/ L, t# y& M% y8 Z! Z- O- W { / {/ a4 ?1 D q! p
return (('0'<=cCheck) && (cCheck<='9'));
0 u3 L7 F' B7 _- v } 5 O: H/ t& C2 b; V2 H
2 j2 ?/ y; x6 @
function IsAlpha(cCheck)
( N0 k3 |! L9 w7 k! n' ~; h+ U1 O { " S" f' a/ y( E" W: ?4 ^
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
7 W4 f0 A! V8 ^ } 6 Q( j0 ]/ |7 |# g! _) ~' v
# w$ N& G! x7 D4 b$ m" h
function IsaNull(cCheck)
, |# k7 ` Y4 E/ t. X1 Z$ Q: }% F { 7 \: v# p6 u" a T
return(cCheck != " ")
) K$ V2 T( I+ `; h# i6 V } : l! @/ g( n0 G- W# h" O8 ~; ~
' I+ ~- t ~7 Y5 h* t* D' b
function checkform()
+ K2 ?4 j7 `! f+ a' h{
/ b6 U$ N/ }/ Q7 s6 j+ L# p. T7 u id = document.sform1.id.value; + X" O/ Y1 g2 H, u- m( ?
if (id == "") + w) u, N9 u" q9 |& t. S7 W/ q9 I" C
{ 8 o! e8 J! Z9 q" R1 W1 R
alert("请输入注册名");
& D" x$ J' j D$ {" r document.sform1.id.focus();
( w" F& G. `# \3 e3 | return false; 6 A, y+ Q2 x, c* x
} L$ |: Z$ E8 x9 Y9 J
) d9 ^. Q0 c3 p; ]. l for (nIndex=0; nIndex<id.length; nIndex++)
7 g% w8 C& A; H$ c1 X$ a n { 4 G. r- P, N$ E+ P$ G* O
cCheck = id.charAt(nIndex); ) L8 R) m: Q) J! l/ K# K7 L
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
: |3 D9 b5 f; E. A9 ` M3 A { 0 L4 j4 @ r8 v
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ) E1 X1 w& b' U, z3 O; W, h
document.sform1.id.focus(); - [1 ?4 N) G. s1 O9 h
return false;
( ~1 T: \ d4 x5 w' }: d9 X } $ Z3 S/ w0 w. s B+ |
}
5 `1 T/ T7 }. \ chineseid = document.sform1.chineseid.value;
, q4 u; @% k3 W if (chineseid == "") ' i2 s0 _9 ~7 [3 h
{ ! ~- [ X$ H7 S" A
alert("请输入中文昵称");
/ N% c8 w# v7 \: _% v7 C document.sform1.chineseid.focus(); 7 U6 V6 i6 M9 R# [7 f9 {* g/ Q
return false;
! z- p3 _7 }/ N# [/ o# t/ Q } 8 ?; x7 V) j; W- \& @
password = document.sform1.password.value;
+ V# ?4 [* g: C' I/ \+ T4 t2 q if (password == "")
7 o0 c: V1 S u/ G. v8 \ { % B7 ^# `8 w9 }$ s! d
alert("请输入登陆密码"); 9 L f; c) Y+ d" D5 Y7 S
document.sform1.password.focus(); $ R. }; P( S# T) l- i5 u
return false; ; K2 A! I h( t+ t6 {
} & c# [) s/ l. X1 z
password1 = document.sform1.password1.value;
/ G: K K+ J8 X: Y0 V# B/ a, Q if (password>password1)
& ~1 B) \+ Y: t9 a8 x8 x& ~: } {" Z; m- Q9 d- \. j
alert("重复密码与登陆密码不相同");
" s) P( _" t: a9 q document.sform1.password.focus();
& F+ ^# v' q! D9 g% x/ G document.sform1.password1.focus(); # g+ V! X* T& S& k9 K7 A5 j
return false;
! E( {/ ?! J2 U } 1 g6 [5 w0 u8 R# O A9 C
if (password<password1) & X/ L6 M' n& b+ D* {+ @5 K5 j
{
4 q2 e5 N: X% W: ?, b alert("重复密码与登陆密码不相同");
/ l3 c# n2 H7 L" O, j$ h document.sform1.password.focus();
! R% C( O+ e; V* F7 @( g6 F9 c document.sform1.password1.focus();
$ m% N* b' k$ N) z return false;7 [, e0 {5 G' ?+ o
} 7 i" i7 F* X! G
if (document.sform1.email.value == "") ) e' q; ]; C& i$ |* z
{
1 i( C% G; t% M" a* U6 G alert("请输入您的E-MAIL地址");
+ E3 G' Z/ a/ N; J) ]2 O document.sform1.email.focus(); . H5 \. L( I5 s. h" b0 X6 Z' k
return false; 5 X/ u8 i; h3 [' {) f/ u
}
A, a; D4 }1 e4 K. h* s
- g, U$ P3 _ y1 ?! x email=document.sform1.email.value;
+ t6 p0 [* B7 @) R, y emailerr=0 l2 s( Z2 @1 \* V9 L9 w
for (i=0; i<email.length; i++) . M9 Y/ q" o: i; [. x) C+ R
{
) k2 J3 G5 _- H; M } if ((email.charAt(i) == "@") & (email.length > 5))
/ K9 ]- I/ \! o {
" s0 @8 [+ ?) I2 ]4 O; F( B emailerr=emailerr+1
n8 Y" i h3 L @1 g- O* V6 t* Z } $ v6 t* {! k( j
}
) w+ y# o8 \) F* b% j if (emailerr != 1) 3 ^; R/ Y: y8 V& x! m
{ 4 z+ U& u | ?: r
alert("请输入正确的E-MAIL地址");
1 N4 k+ D: G7 _7 b K% \3 u document.sform1.email.focus();
# p8 P7 G- r x' ~- Y return false; 9 L/ E' E. r8 x4 _
} * _6 E& f1 \! g5 k0 F# W
* t3 n! o* K# J+ o if (document.sform1.checkask.value=="")
7 F% b* X3 B3 \0 V* ^! r {
$ e9 I/ i+ z6 F2 M alert("密码提示问题不能为空");
0 G; [% O2 A; o3 g- W" m- b document.sform1.checkask.focus(); " ]6 U! ~- i# D# ~; B6 B
return false;
& ?; I) Z. [" a" U% R } $ E! t& _& j& f& z
if (document.sform1.checkans.value=="")
& w# q) Y7 B3 ?- q' G' F {
" h/ S S0 j" ^. D$ q6 l. q alert("您的密码提示问题答案不能为空"); 0 e0 Y8 S) {7 N4 [+ g# a1 l
document.sform1.checkans.focus(); 3 m7 g9 W9 n) |; P1 F, E* V' S
return false; - P' _) ^1 Q( ?5 e
}
$ B$ u% U( S y0 h' B, a return true; 2 U% ^1 g$ X: y% W2 ~1 [
8 u u7 n2 }5 N8 c. V) P} 1 {# }! W/ D: m2 S4 O$ \
</script> |
|