|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14437
- 金币
- 2504
- 威望
- 1647
- 贡献
- 1452
|
这个脚本对你可能有帮助:+ }4 }* p$ ` L7 r2 z9 K& D( J
<script language="javascript">
3 r/ a& D; B" _. sfunction IsDigit(cCheck) / Q% C( {* v9 A% H0 _" L
{
& P4 H t' S1 q$ @ return (('0'<=cCheck) && (cCheck<='9'));
: Y3 e1 u- X# m/ j0 G9 F } . m( u* b0 {) N4 I
- N. ~. r% Y0 U4 w4 bfunction IsAlpha(cCheck) 7 X+ E( r" [9 D
{
; c/ E$ Y" r: `- O! D. u return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 0 |! j% R j4 M# n S% Y0 l4 O
}
2 ]- w% I! ^# N" P
) X5 a8 J# q, P, I4 D; ^function IsaNull(cCheck)
) @7 ]$ d5 M% X* W { 1 M5 f. l) c4 H1 p: Y* t+ I/ E1 Q
return(cCheck != " ") 6 l( M. `2 v+ k- {& h/ H
}
7 {' M' j/ J! |0 U1 G
# p2 L" v) Y+ N/ Wfunction checkform()
9 B% E8 `7 } J{ # o5 A2 N4 @6 C% b4 m
id = document.sform1.id.value;
: ?$ z1 z) B; x6 N; q& O if (id == "")
. h; j) C7 X! m5 r$ P# ^ { ; i( R% ^1 S6 ^: V' A: n
alert("请输入注册名");
! b0 N: A% R. O3 B5 Z document.sform1.id.focus();
' X4 o. v3 x) |2 Z T+ D& c return false; 3 ^/ S( ^5 s2 x5 f
} 8 q& h( Z, d5 ` }3 @; o; I" R. j% e
0 y9 j& \5 \ h
for (nIndex=0; nIndex<id.length; nIndex++) $ A: Z; x. o3 T4 s) D. n1 q- ]% i* E
{
: K/ Q( W* p1 k5 x% S$ i3 T E cCheck = id.charAt(nIndex); ( V. y: M6 J4 a( A+ U- K: u
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
/ o) e7 ]! g1 X. V { " ^! f Q }( u4 W" `! G
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); * f$ f) v7 j' |7 ]/ e ^
document.sform1.id.focus();
) `2 M$ Z* R4 m return false;
5 j9 ~4 {" v2 K, a7 W9 e# `' i5 s }
8 e$ S+ G$ \# j" a' ~) ]$ { }
, p/ v) n! x" D7 L& X chineseid = document.sform1.chineseid.value; . P3 x d, s7 J) t8 k
if (chineseid == "")
8 n ?* ]7 G" J/ [ {
* F; A/ K1 g! [, ?) W: g alert("请输入中文昵称");
; F* F" J+ C. n, M2 I: b document.sform1.chineseid.focus(); 5 g* A4 h+ Q1 S: H0 ]' q$ p
return false; 3 C4 B* v) l4 S% y
}
, j3 n6 G: ^0 J* @( L password = document.sform1.password.value; & d. f- G7 \9 g3 {
if (password == "")
" [7 J% p% l) ] M- G3 D {
1 V/ z& S1 Z. n) {- j alert("请输入登陆密码");
, h$ x+ Q5 ]) S* _$ R document.sform1.password.focus(); ' y. s4 C2 B- [& B5 J* Z
return false;
9 W) I" }1 y( n! Z }
5 [+ l- P/ ^8 \! x' i password1 = document.sform1.password1.value; 6 o8 [% K9 z/ j9 z
if (password>password1) 9 x [5 ?5 l u1 I
{
; F, Q) g; C- r" [9 p alert("重复密码与登陆密码不相同"); ( K9 [3 F9 r. g! J% Y$ W7 `
document.sform1.password.focus();
# R. N4 ~$ _& N5 y" D6 | document.sform1.password1.focus(); ; [: \% P* Y/ e) W; O4 ~& U
return false;# `: o5 U2 J1 k5 w- ?9 ^' \
} 7 [0 ~* U( O% M5 w4 O/ t
if (password<password1)
- x. h! I# A3 s0 k- e( H {
/ T1 m1 R1 m( y: ~5 @1 g8 Q' U alert("重复密码与登陆密码不相同");
. W. o" S! I2 n* k) n S2 D document.sform1.password.focus(); 4 U% t% e0 N( S E
document.sform1.password1.focus();
u# }& S2 N$ ?- I$ a: y# l/ G3 W6 [ return false;
4 j0 \2 w& \; E8 n } $ @6 @1 z, Y( I |1 Q- N0 J
if (document.sform1.email.value == "") 2 h0 M: ~1 Z% y, a
{
# u) c0 O2 t" M0 k alert("请输入您的E-MAIL地址");
6 `. b- v/ b/ c$ Y7 t8 f) y document.sform1.email.focus(); 6 c+ N, P- j0 ^9 |7 {1 @8 C! u( ?. b1 z
return false;
, f1 u/ e6 g1 s$ c. a( ~ }
! @" b& c" T* Q; d& l P
, z' ~$ |3 T* Q7 V% k email=document.sform1.email.value; : o( w2 C U, ~) h2 R) G4 W+ l. f
emailerr=0
) ~# w6 S: U& G& ? for (i=0; i<email.length; i++) % W3 [7 w$ V4 N. X/ t! {* A
{ 0 n8 I* ^9 r0 a; T" y: l2 s
if ((email.charAt(i) == "@") & (email.length > 5))
) M) v8 v" Y( A) K8 ^ { % p/ [" n1 y( o: A; } q
emailerr=emailerr+1
( h$ @$ b3 t( H( h8 p2 z5 W } 1 C3 j9 t% \# u7 n! w. G% ]
} ! h! V& e- U3 T2 X# w
if (emailerr != 1) * z7 ]# X' \6 |$ c/ C. D2 q
{
B' Y4 O" `. {; O$ N" W% c1 C! ~6 G alert("请输入正确的E-MAIL地址"); 7 k e- i C! e% q# q* Q* K7 h
document.sform1.email.focus();
9 ~+ e5 A0 A- B0 C return false;
6 j' J' U! J+ ^! [$ J0 E5 {8 { }
5 e" z. H7 S. p2 E9 K0 z: M; j! A ; N+ v( L8 R4 j0 f
if (document.sform1.checkask.value=="")
6 o9 B$ C# q+ [7 s' @ { * p; T# A7 U7 [
alert("密码提示问题不能为空");
& u; H F$ c' Q: V document.sform1.checkask.focus(); ; `- C! A3 A0 d W! x& Q
return false;
8 E% P0 I r/ }) D; v: } }
& q* m# R! K) @8 w( x9 ]$ f3 i if (document.sform1.checkans.value=="")
0 i+ V2 U! l0 ]3 D. \( K/ H7 w {
$ E8 G6 V/ d5 `/ ^. b4 k alert("您的密码提示问题答案不能为空");
' y1 {6 y4 M& r' a document.sform1.checkans.focus(); 6 ]8 u$ P" t# ^- `" g( _
return false; * L. b: m2 e; ?" G% {6 b
}
* @; f) |: m% J) e7 X3 b, m0 W return true; 2 H5 e8 b5 n8 h: v* e# G/ B! r* ~+ @- ?
# `8 p6 o3 ]7 { q4 l
}
$ G) P6 W) Z+ V</script> |
|