|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14313
- 金币
- 2442
- 威望
- 1647
- 贡献
- 1390
|
这个脚本对你可能有帮助:
/ N7 l$ \; f* b$ n5 v3 ~<script language="javascript">
3 z5 d5 e% Q& U/ ^; l) hfunction IsDigit(cCheck) + n0 a: U6 K( v1 j$ h/ z" K( O
{ ! Q! a' K0 z% b, w
return (('0'<=cCheck) && (cCheck<='9')); ; j$ [# M. H! k( q
}
W( E) f. V& H$ Z `, ?
! N! H9 z, w/ Wfunction IsAlpha(cCheck) 6 _% E: u5 c1 s5 s5 Z6 M# K( k
{
6 y, `, `3 M! h' d" b3 \ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) # x( F X" l1 w
} 2 n+ R) ^ j7 p2 _! l
* R& E: H Z! F2 J3 a; Zfunction IsaNull(cCheck)
5 c2 u/ G" p! f: r0 o {
$ U( v7 D# k4 W' }! X; a0 Y6 h2 f return(cCheck != " ") # @4 \3 E7 O6 w4 O" H$ L
}
) s8 I; {4 O% j! v/ E
5 Z9 H! L7 D$ B( K9 N1 yfunction checkform() 2 B& @/ _7 n8 l r, d* P" [
{
; V0 B" N9 h2 B+ P id = document.sform1.id.value; / x" i2 \4 o$ h- w6 `1 w) l3 Z
if (id == "")
: o& r# k! K8 S8 A/ m, w {
3 o: W2 V" J' \: b alert("请输入注册名"); " w6 [, Q2 A; N
document.sform1.id.focus();
( e5 q: T' s+ f* o! P return false;
. w1 \6 s. u- K5 ]# q } 3 P4 a2 H; H. Y, ~% y6 @4 b
0 H4 E% d; e |0 r5 V, L for (nIndex=0; nIndex<id.length; nIndex++)
3 r7 X( s) q' r1 } { ! u' T: ?$ a# D
cCheck = id.charAt(nIndex);
/ z# B3 `4 \) }0 C/ X' C" N if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) / r8 n5 q; g- {" }; s
{
E* D4 Y2 V6 J$ q2 S. L alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 5 _7 G. ` r* _3 l# y$ f1 ^3 q
document.sform1.id.focus(); : A: m6 R) K7 R% U/ C1 K' n
return false;
2 w4 r+ C! O% b& W- s; m' I1 Z }
4 p0 G+ u3 d& Y" [$ @1 a U3 h }
4 n# ^8 |, V9 Z. m% j' W- a chineseid = document.sform1.chineseid.value;
8 w+ W; U" U9 [" g# k' d if (chineseid == "")
3 B4 U/ l! ~$ L6 b$ Z5 q { " f7 F; |7 N0 V& A! F6 ^' M% l
alert("请输入中文昵称");
* T V) h; _* J8 T; u document.sform1.chineseid.focus(); ' Z9 P8 G& B1 k6 B
return false;
: ^2 R0 J. `% ]- x }
$ U) `) R1 B9 G, @" B1 o- u a! z2 ] password = document.sform1.password.value; 2 @& ?' c* {! a) d' v" V6 x
if (password == "") ( Q t! l; u, P
{
6 }( V7 E" m8 Z! E$ g+ v/ k8 e alert("请输入登陆密码"); ( w( T; K6 o6 Q I- [: x. D. ?
document.sform1.password.focus();
J- G3 c$ {9 p# N f7 Q return false;
. _. }4 {! P# j% E! k } 3 @' }" Y7 B& O) |
password1 = document.sform1.password1.value;
5 ~* \+ Y: b( I5 |4 r. y! Y if (password>password1)
: x& g' _# M7 I5 D {
' b3 F$ b- k2 t- V4 g alert("重复密码与登陆密码不相同");
/ N7 M6 S/ W4 ?% x document.sform1.password.focus(); 9 v, D; s8 _: y* A4 m
document.sform1.password1.focus();
) ^: U, s- ~% K* u. ?9 `( q return false;9 e5 F, I2 R! y# e( [( {4 {8 N
} $ r7 k- Y* _: ?5 U* G# L# T
if (password<password1)
6 X% M! L3 T; \5 r5 | {; O! I& W, h- q! `6 u
alert("重复密码与登陆密码不相同"); 4 a7 F6 X+ L2 x' v7 x
document.sform1.password.focus();
, @* E4 b) ^$ C# `4 I1 Y$ m0 p1 ~ document.sform1.password1.focus();
, Z3 V( Z+ O1 \7 v, |4 [ return false;2 q- \8 P. s# s- Q1 r& v @3 o B
} 1 E8 l* r% @) ?, {
if (document.sform1.email.value == "")
& L$ P6 `7 _0 _+ F* F0 ]; j { & t* U4 L. Q( p U9 k
alert("请输入您的E-MAIL地址");
. f" c3 ^% |1 a* A; x' e document.sform1.email.focus(); 7 x y/ I* h+ u) {. [& t1 k. R7 y
return false;
& j1 X( F4 m2 x7 p5 x } / r$ J ?3 c; k, M) _/ h& h& \
1 A5 U5 u9 v5 S* w( X! h# j
email=document.sform1.email.value; ' I2 X# z. q: K& ?1 B) F
emailerr=0
( I, s9 z' {4 x" ~6 i for (i=0; i<email.length; i++)
. T) g Q0 m+ n9 @# N { 6 z. |2 A5 \8 U* O* g
if ((email.charAt(i) == "@") & (email.length > 5))
5 B3 @" x n$ n4 H! y- a {
0 @* |& p4 Z X# l emailerr=emailerr+1
/ G- H9 |1 |3 ~5 n: F" o }
1 Y) Y8 ] q' T5 u9 X } ! @% L' `3 K, C/ v
if (emailerr != 1) : I3 m- u/ I0 C& F- L5 M
{ / I. d% D# u- {! A
alert("请输入正确的E-MAIL地址");
9 ]/ D& H3 j" C* s! ?, z, N3 m2 o8 a document.sform1.email.focus(); . G8 N; J. o7 t8 q$ |
return false;
1 d7 Z( C! w4 A2 m }
9 I2 E- _3 w8 K8 m9 T7 }! m7 ], V ' @$ O* ]0 `. r) W
if (document.sform1.checkask.value=="") 2 u, |; b( J7 N# I4 P1 W8 S
{ 7 y4 J) |. T2 P
alert("密码提示问题不能为空");
+ k% J: ~9 \" d% V document.sform1.checkask.focus();
0 L3 ~7 M9 `2 h* j$ f return false; . I( Z) W" B) u. D
} . `5 D5 w8 z% _5 v: b) |. Z9 B
if (document.sform1.checkans.value=="")
) X% `! K2 z: s0 c { " e6 I: n5 R4 }; ` x; Q$ |3 E
alert("您的密码提示问题答案不能为空"); ; H0 P! ^( U! k1 ^
document.sform1.checkans.focus(); 7 m% S! [. q6 X& ^
return false; ! \- J) m0 L1 g5 x" }
}
) v8 e% u) r8 J! N. K- o return true;
9 _: v, M8 B3 F" L
! Z2 n |3 g. }3 ]/ J}
/ r% I$ F+ r _- i5 L3 w5 t</script> |
|