|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14369
- 金币
- 2470
- 威望
- 1647
- 贡献
- 1418
|
这个脚本对你可能有帮助:& P; P+ t( y+ r% r4 b( O
<script language="javascript">
& H- s' r, p$ afunction IsDigit(cCheck) # [7 G u5 [ S( c) m" z( o
{ # _$ l" f! ` d7 k+ _
return (('0'<=cCheck) && (cCheck<='9'));
2 x) [2 b# i$ |4 B% t& B, J H }
) k9 d( k9 @" B- b* o
. P- C4 q: b* g8 z7 `7 _function IsAlpha(cCheck) & U2 S4 g7 o6 L5 z
{
Q; o/ F7 L/ R return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 6 H! k/ E; B; C" b5 k/ ]
}
! O) \1 ^* l+ O q( S : \9 V% ~2 @7 D
function IsaNull(cCheck) # W: z/ n, @' b- h" s
{ " }% E1 f; U0 z
return(cCheck != " ") ) l2 s1 Q% {# N/ i) R9 L' y& k
}
- u s; U* e8 K6 x
! J) P* w; T2 _ l+ L$ D) A: D& Gfunction checkform() % B5 `9 A/ n* t: z
{ ' ?2 K$ J. q& m& @6 T
id = document.sform1.id.value; $ _* o: u4 _4 x8 N
if (id == "")
7 p4 g0 S* v/ v* T1 K, Y3 r2 \ { 4 g0 \8 c0 @6 r5 ^6 \0 N
alert("请输入注册名");
1 l/ M2 E: ?- r" R. e }4 ] document.sform1.id.focus();
1 e7 U& R2 f- C, W return false; 9 F, e. j$ L8 B
}
+ w' M b- V1 j5 s1 ^ O: E* a
1 _( ]. c& t1 ]* u0 W for (nIndex=0; nIndex<id.length; nIndex++) 1 L- ?* S- _+ m% [" F
{
; w' O2 L2 t( E; \9 h( e2 B. t* ? cCheck = id.charAt(nIndex);
1 w# q' m: v* l8 {7 l/ o; y if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% b5 [: W7 t& h9 H% x { 3 z0 B7 I5 @8 `1 K+ i# m. `
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 3 |! H$ @: c& ?, N
document.sform1.id.focus();
3 l E' T1 B* H* A( K- q return false;
9 ]. g! D r4 Q } ) \/ `7 t6 [( ]! Q% U, E
} R# M" p/ L7 |
chineseid = document.sform1.chineseid.value; ; P6 @5 @4 C# [: V# P, O
if (chineseid == "") 0 Z# ]8 f* {& _ e, [
{
% z# a$ v; U U D1 r. y alert("请输入中文昵称"); 6 l9 W7 n: ?- E: o# Q F
document.sform1.chineseid.focus();
* }& t1 [4 p5 Q8 @' F return false; 2 v1 _6 c) B6 F2 g0 Y/ a) ~! t# a
} % U8 n0 N/ b* `; i2 q; p# j
password = document.sform1.password.value;
. \# c7 s* k) L, _ if (password == "") ( W6 w4 N. V3 O" ~
{
5 u' j" B: ~1 H! W4 q; G/ o* f* u alert("请输入登陆密码"); 4 I( ?" P( S( y; q2 g
document.sform1.password.focus(); 5 X: E, d) V1 M, O2 j7 a
return false;
5 O& j, o' v2 b$ r6 F7 d8 Q }
?* I6 U/ ~( t password1 = document.sform1.password1.value;
4 K' ^! o2 h0 Z3 A) y) o if (password>password1)
: ]! m- O1 @2 t0 o# ~ {5 g5 j! U: F5 K/ Q$ t
alert("重复密码与登陆密码不相同"); 0 V5 N/ {7 L3 }4 [' ?
document.sform1.password.focus(); . ?7 j3 k, G. x3 _
document.sform1.password1.focus();
) d, M4 q2 E; f( ]. q, F8 n: b return false;
6 ^' r5 H; x" W7 D } ( H6 E3 y2 |+ J8 Q" N! {. X9 _& }
if (password<password1) . r2 `. S7 x+ ]% y( \ A* m
{
* s9 T" m$ M; ]$ x. E. k) y3 h5 ` alert("重复密码与登陆密码不相同"); 0 f0 Z/ {8 |3 a7 R# V4 ?* E
document.sform1.password.focus(); ) O8 l% z& T# |, j3 w. e
document.sform1.password1.focus(); % d1 {, P. I1 j
return false;
/ b$ S! ^4 c) D) c$ P$ j7 K }
) {. {0 }! C3 w4 S# \ if (document.sform1.email.value == "")
# k" j5 D, ~ q/ _8 t. A& }3 H: T: v {
% }) m1 w' B/ e8 n: {& v alert("请输入您的E-MAIL地址");
+ N, o2 e! J Q. f" o) m8 e6 h document.sform1.email.focus();
, Q& }% a2 R. M4 w) `) \* G d1 z return false;
7 q/ y G( s6 @ }
; J+ y% ?" M: H- j3 }& S
8 f" p2 L+ @ y* B8 p" }. Y email=document.sform1.email.value;
! e; m6 R) i4 M' A7 m$ |. t emailerr=0 . J% w3 U; U* X
for (i=0; i<email.length; i++) 6 b. b, I S$ L2 O8 ]: K9 g
{ " t4 | J5 T3 I+ u/ o; k
if ((email.charAt(i) == "@") & (email.length > 5)) B8 J- C0 I! G4 y3 _" f
{ 0 _ b( j" Z& D) Q5 `( w/ B
emailerr=emailerr+1
7 V/ Q( m H) S2 u. ~6 q* Y }
. ?+ C4 g6 k a9 D* e } 3 f$ @4 C3 C* X9 w: c
if (emailerr != 1)
9 a I0 E" l' p3 Q2 S! j {
( I9 s8 q# p9 i) i$ N alert("请输入正确的E-MAIL地址");
) p( A8 l- f1 J6 U+ Y. I% O8 R5 q/ D7 w document.sform1.email.focus(); ' f' \4 O) f2 |
return false;
$ m3 V) i/ m2 K$ W" H# B }
. x2 S1 H2 G! G2 { H: T8 J6 H1 Z4 w4 a$ F% k5 H
if (document.sform1.checkask.value=="")
2 s8 V# L* l. J$ x- }9 O" L { - D R1 V8 j7 V: j
alert("密码提示问题不能为空");
% t2 @/ Y$ j5 S& j9 n: e document.sform1.checkask.focus(); 5 ~! N, t, a- @! s2 u2 f- A
return false; 5 h, x& Z3 U/ X
} ( |* Y$ Q7 R! |+ g& o" K |
if (document.sform1.checkans.value=="")
1 e s7 u0 a- X: g {
* ~- D2 y% v$ Q* j1 ]% r: V! l5 u alert("您的密码提示问题答案不能为空");
8 [* }$ s7 Q" z8 M, i. r* c2 [ document.sform1.checkans.focus(); % u9 q, J. i; Y3 n" g7 M
return false;
: _2 H0 _2 A+ x$ o/ l }1 o6 K4 e) Z1 {+ n% \
return true; ' t9 L/ B9 c/ ~' _) ]
8 P8 I; @! d3 \7 [+ c9 f# {
}
9 Q! P6 E8 x( b; Q2 x</script> |
|