|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14323
- 金币
- 2447
- 威望
- 1647
- 贡献
- 1395
|
这个脚本对你可能有帮助:' U [) _/ M6 a. ^: O
<script language="javascript">
/ X+ s+ j# q5 H* K& w; O. s: @0 Rfunction IsDigit(cCheck) ' z+ G4 z1 e, h( n5 }" C9 j
{ $ T( e; J3 U8 x" v
return (('0'<=cCheck) && (cCheck<='9')); 0 J% {% ~1 X; {# b0 ~, h
} ( k; M) K# D; Q9 G: g& x. o
# ~4 u/ B/ v2 J
function IsAlpha(cCheck)
! O; \5 [& p7 Y1 x { 8 L8 o9 G6 G0 e: \& t5 R
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) $ K/ b! t) e/ S1 T
}
7 q* I& ]# h. X7 j: A& l
' w2 N6 ^- a) l7 A9 ifunction IsaNull(cCheck)
; c* I# o: e. _! Y W# ?* { { 9 r$ R9 q$ o+ c: y# ]
return(cCheck != " ") : \2 e$ A2 u1 y* ^6 c1 k8 l5 @, s! s
} $ V& ^1 ^/ ^4 v# M3 D7 V6 y
5 b. V! k' v6 j* e! yfunction checkform() ! A z0 Q$ m( J) r
{
+ l/ N; ]$ I8 D6 G- W id = document.sform1.id.value;
7 z9 [2 g/ C0 C& X$ y if (id == "") & n3 \0 x# b8 f/ }2 u+ a+ H2 z
{ ( l0 V1 L9 n3 m* B
alert("请输入注册名"); - v7 D6 O) y8 g2 F
document.sform1.id.focus();
3 Q3 e3 F: ?! K1 t" \( K# o) d& M return false;
4 L& |1 p9 `; y9 |2 O6 [ g }
5 B/ A+ k; K5 M2 {; l) D; f- Q7 T
! K( n% x1 a6 A* E% q for (nIndex=0; nIndex<id.length; nIndex++) * A7 e3 ~ }! d
{
* P- E% ]. ] T1 w- f cCheck = id.charAt(nIndex);
% M9 k7 i6 d5 c2 g. R8 w if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) & |- y' k$ {' d) E! p+ _& l( R
{ 0 U4 p$ }! i9 o$ t
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
; G- a/ |, u. K" a p document.sform1.id.focus(); 5 U U g5 X% K7 a$ C
return false;
2 @( U. o9 Z. f( w: a& q } ! _- e" d+ Q, B
} ; ~2 ?0 j3 J% L' H I' ?
chineseid = document.sform1.chineseid.value; 5 u+ m( s! A" |4 V" A! Q3 \9 L
if (chineseid == "") 1 ~* M( ?6 D' h, L
{ " v4 U' ^2 i8 `. l N/ ^
alert("请输入中文昵称"); 3 l% L" D* j0 J; u
document.sform1.chineseid.focus(); ! @1 |, H2 h4 K! y. H# A" w: X
return false; . x5 c% t5 |* k/ L% o0 h3 z3 v
}
. l# _/ ^3 [% f, {: \" r! c. q password = document.sform1.password.value; , f" R4 w4 |0 G$ k
if (password == "")
+ ~+ L4 h% f9 i+ l9 A: U {
, z6 S7 W2 G' f, Z8 U+ K3 s4 e alert("请输入登陆密码"); ' c& P' `1 C% T; |* |
document.sform1.password.focus(); $ @, i: A, U5 q# f' W+ G& S
return false; & V4 b! ]) c& D
} & d [! w+ a) M" U h+ F
password1 = document.sform1.password1.value; ) n! B. p6 x# n; p5 x! c" f' _
if (password>password1)
6 U5 ^9 K' X w' ~5 P {
2 E9 r, } G+ p% F alert("重复密码与登陆密码不相同"); 7 N% H. i: r5 ~9 _: g: r
document.sform1.password.focus();
& |& b6 [7 A3 V document.sform1.password1.focus();
6 A# B5 \3 p0 F$ b1 N- g return false;
. Z, ?* ?2 }" [0 P4 V }
9 g! ~/ j1 Q9 Dif (password<password1)
) Z5 o6 }7 i- P1 n {
' q; i' |, V1 t% m& v alert("重复密码与登陆密码不相同");
?$ I4 l' S Z1 |$ Y! r! O i document.sform1.password.focus(); ! V$ m. U9 W& a* Q
document.sform1.password1.focus();
4 Q: E: a2 q8 Y7 {9 Z5 h; S6 J return false;9 Y- F: w4 s ` ~" f
} 4 q, ]9 c! ]- c, n s$ I' G/ }% W% a9 t
if (document.sform1.email.value == "")
+ I ]( _ S6 V$ t4 J { 7 j! g# N& G2 |2 m3 Q6 d- T' k
alert("请输入您的E-MAIL地址"); 4 L; F. g4 q# w! `! |+ w- \
document.sform1.email.focus(); $ A. S+ I v8 |7 @- o
return false; 7 j& p9 M8 c+ k# X- N
} 5 Z" L" O2 z J0 t8 Z
1 ]4 S7 p4 l+ [
email=document.sform1.email.value;
# z4 j2 u; k0 ?3 ] emailerr=0
' H/ c: ^8 z% U for (i=0; i<email.length; i++) 0 K0 Q, V4 s* P3 v/ T6 o
{
N3 m4 H- C. U/ x* Y0 R7 L2 m3 P if ((email.charAt(i) == "@") & (email.length > 5))
& H9 D* L1 M0 G { 1 h1 S6 K$ {% O& i P
emailerr=emailerr+1 ; y& p/ S7 k7 E/ H9 ^ u/ O: C
} % G+ R. O6 j2 V
} . u0 r3 E0 P) _& y
if (emailerr != 1)
4 V7 e* A' ?1 y6 s {
. C8 i8 V# ]4 k6 g+ G alert("请输入正确的E-MAIL地址"); 6 J& j& b2 b0 m5 _
document.sform1.email.focus(); : q. x' W M9 @0 @" A: L
return false; / z0 D6 O9 `' v- @2 z& w
}
- S# K j- W- w7 F# s, L: F 5 n! b0 [! o6 Q7 ^
if (document.sform1.checkask.value=="") 7 ^, n( w, k g# M5 k8 L
{
: ?4 b6 g5 K" m& G$ P! E1 L alert("密码提示问题不能为空"); ! y4 e7 K7 A4 B3 v' c, f) b0 P
document.sform1.checkask.focus(); : x! ^0 ]( x: G! z6 J* I
return false; , D' X0 @) x0 ?( k
}
2 ~1 w1 ` I4 g! v" t" F- w if (document.sform1.checkans.value=="")
$ p! Q. ]8 s3 R) Q H T3 c2 W { , t3 l; C7 _0 f7 k) ?
alert("您的密码提示问题答案不能为空");
# P# n4 c6 M, K: `! v3 v" e document.sform1.checkans.focus(); . c9 k) ], N! _
return false; : a2 O# k' q& Y, C% Z; }
}% a+ _1 t- x4 E" L: Q, ~! m
return true; ; U. d5 r5 f3 m% B& a# ~& _
6 W( m7 M# n E( f) u2 h6 t
}
$ g6 {- k' Y* J% a. C</script> |
|