|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
这个脚本对你可能有帮助: S+ ^6 q1 V4 ]2 W! L: w
<script language="javascript"> ' E& D" I- k6 O* _2 L6 }6 Z, A% ^
function IsDigit(cCheck) $ c& b$ T, b3 |' h* O+ t
{ ( N+ o! z7 L. n! a; v; l
return (('0'<=cCheck) && (cCheck<='9'));
i2 Z# F0 _& i% Y9 x# f5 w }
9 ]9 d: P5 v5 I5 \' b B; N, A 8 D. ?: S z: R
function IsAlpha(cCheck) X- g6 g9 @9 _' U1 ~6 [7 z8 ^
{ 0 f: m& T+ H* W% l! G5 X- \
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
' E4 X5 Q# w2 y0 e% a* d1 [3 R }
6 l$ N- S! A1 `! r' R0 u1 F) |
. R' O. S! x M6 }% r5 r/ Kfunction IsaNull(cCheck) + C* Y: \) `$ c$ L
{
3 n+ G; w, Z5 o( T( W return(cCheck != " ")
% T8 C+ b% Y9 @5 h0 l. Z }
% D( j9 N1 F& b& q5 c) e. B, O' |
2 k$ B% j- {( ^1 O: v0 Y1 Ifunction checkform()
6 j3 [1 W7 W! V) J$ n{ 3 S: w0 ?5 ^! m! w0 j
id = document.sform1.id.value;
* m0 l% t1 d* V; d" h! A: Z' [ if (id == "") $ n# n9 f3 K. B' Z
{
! ?+ l- O1 C( t/ R# H. @( a alert("请输入注册名"); + [2 [8 `5 r r
document.sform1.id.focus(); , F6 {' i: }) b! n) k
return false;
# d7 B0 Q9 ~* Q. B7 s$ I# \ } ' | E: N/ n; r1 ]
; l, x, k& y$ ], B9 H: T5 k for (nIndex=0; nIndex<id.length; nIndex++)
3 Z+ l3 K5 H; O1 ] { : D$ K! {+ S+ ?
cCheck = id.charAt(nIndex); & I1 p& b4 \0 B$ u
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 5 } |- Y/ V7 }! o: k8 ^( J. X. ]
{
$ O8 [/ O: Y) X4 D alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); + l* h7 ], p7 W" p+ w5 J
document.sform1.id.focus();
0 D z0 H6 |, v1 _, b return false; : J* `% `9 r% V
} 2 N4 c/ b8 x0 Q& d. h3 _& a3 M
}
/ u: z. K, n. q1 w- P chineseid = document.sform1.chineseid.value; $ o" u. p1 P C9 l
if (chineseid == "") " n0 r! |, D4 k! \* f: v
{ ! e& K! @- K6 c y7 V7 T7 S
alert("请输入中文昵称");
( K8 Z2 Q$ {8 B( N# ]2 X3 Z document.sform1.chineseid.focus(); - W8 F1 {9 {7 S9 g0 i! o1 h
return false; 2 P' v! }8 l* X2 S$ G# Z* L7 \+ X
}
( ^, J. `8 I4 f, R2 j password = document.sform1.password.value; ' Q5 X3 l9 ?5 f4 @3 E, r7 I
if (password == "")
3 S# t8 O) q. i, }) ^8 | {
2 g2 s& V% \4 m5 } alert("请输入登陆密码"); 6 ?% x w0 A3 [# C
document.sform1.password.focus();
1 [9 [1 `1 @% [ return false; / i$ g1 T6 ?9 T% e! e* \% z' q7 M3 B
} 2 @& N* o/ S. ?; E0 s
password1 = document.sform1.password1.value; + X1 f! l9 f. A/ m/ I& O9 ?
if (password>password1)
; ^- [+ n Y1 |5 S- ]% m0 X {. @7 S/ m8 v9 l) I; i4 e
alert("重复密码与登陆密码不相同");
5 i t# o" |% q* ]7 Q document.sform1.password.focus();
7 K4 ?7 [0 X8 r, ~. C8 Q4 D7 J( y document.sform1.password1.focus(); 4 q8 _2 r$ ^ e- o/ u
return false;
: m$ V7 D8 m, a, i } $ e* X. T7 d) Q: N
if (password<password1) 6 X1 L7 C! W) N
{5 W7 i! h! |, a7 ?& ~
alert("重复密码与登陆密码不相同");
. w% m/ a; s! O6 r- k document.sform1.password.focus(); % o- V. S6 y, _; q- L. E) s
document.sform1.password1.focus();
- ]( b% q; J( N+ t$ P, @ return false;
w" S; G- [( L }
* F. y# G0 q/ ~6 }! h. Y if (document.sform1.email.value == "")
4 P2 C- Y/ l* g {
W. `4 E3 {% m5 z, l. L alert("请输入您的E-MAIL地址");
: Q: ~1 u( j1 l7 k document.sform1.email.focus();
) C: j6 ~7 O* U return false;
4 C* r8 J0 S u- T }
# U: B/ w* D0 C) u 3 T/ D5 [ a$ U2 s
email=document.sform1.email.value;
$ L5 G0 r! N+ `7 v& D- { emailerr=0
0 _: X) A+ }/ q: a6 D for (i=0; i<email.length; i++)
# F9 o! \" u4 Y1 j1 k9 M# \ { # t. T2 k. q" p5 x; s
if ((email.charAt(i) == "@") & (email.length > 5)) - O- _" |7 h2 ]# g( g5 l) C
{
$ u+ a; n/ Y' v# S emailerr=emailerr+1 ' d: J6 r7 W! A( A, _) k+ C
} " _5 V" s1 I' Q3 l. H% a
} # ]% b+ v- d$ @3 q& L0 G
if (emailerr != 1) ) O8 N7 B0 Y; x ^# V' {
{ / Q) I5 U+ z8 \5 o
alert("请输入正确的E-MAIL地址"); ( D% T0 g( s3 h5 E, X7 c& F) T
document.sform1.email.focus(); 0 {0 W- o( X9 ~% e
return false;
2 G! U- `' ]# w. U* g5 ?2 U- q } * }9 d0 G: Y- l8 r7 s
2 x( g7 q9 n- A+ \# f if (document.sform1.checkask.value=="") & n3 M, B) c( h
{
4 M% m/ O+ f) I alert("密码提示问题不能为空");
; Q5 D% i3 B: {7 Y document.sform1.checkask.focus();
2 c" `: }) c" H9 Y8 G3 n p return false;
7 A6 m% Z2 t0 }/ Q }
$ i2 f+ `& R* ~4 k* I& F4 y if (document.sform1.checkans.value=="")
" `5 K) r# g- j8 _* H {
2 z1 Y2 x+ C# p1 V5 x0 k alert("您的密码提示问题答案不能为空");
; e$ T; e3 _4 ~# \, B document.sform1.checkans.focus(); ' ~- C5 Q- ~) ~6 ]9 u8 v' N* ?
return false; , z" C3 Q6 |# ^& e! h
}
$ C. g2 F- V6 l return true;
' A- L8 {: L; u' W
+ M- o0 K# x& j0 W; a} ; e% b% S: w4 ~1 g# P; P" [. L
</script> |
|