|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:
& c8 d, s) ^6 q<script language="javascript">
& I K+ i! t$ t9 a, Tfunction IsDigit(cCheck)
6 Y/ a5 d' a1 w5 l {
, F7 ^/ n" u/ P return (('0'<=cCheck) && (cCheck<='9')); ) N+ H: m* d: h
}
. V1 f2 Q8 X5 F* V6 `& h1 M + I, I. f( W' n1 |4 k" S9 p
function IsAlpha(cCheck) 3 j$ x3 `. s# ?7 M6 G9 Y
{
; d2 L! }7 E& T' |& l return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) , G: ^! a4 h8 V P5 S) f% L
} , h5 ~0 i$ W: B' |+ {
: @) \ i; R4 x5 A( x
function IsaNull(cCheck)
) @7 E" o) g* o: z {
/ M8 W3 W; E3 I' \4 F. c return(cCheck != " ") 5 G8 h. v7 C$ b8 {3 F5 j0 K
} 5 D( p3 T( S. o1 a& ]
/ m2 B) G% V! J/ ?/ o
function checkform()
% E% k+ U( h r6 W1 e{
/ B& P8 }& ~/ w" \/ ]& J( U id = document.sform1.id.value; # G. W+ c# N; b1 D
if (id == "") ) q; a. V3 i9 q5 g
{
2 }( P! ]9 o* P- n% c alert("请输入注册名");
& B4 Y# J: ~. W$ _) p& A4 M1 o( W7 { document.sform1.id.focus(); 1 v5 u/ A4 c) c
return false; 7 x6 R8 F6 Q% l$ V' d
}
7 m; n1 p {8 \, R, u% T # [. ~6 Q' z- k8 W' p
for (nIndex=0; nIndex<id.length; nIndex++)
: E; Y, Y; P, l8 [4 K# s% | { ; ^ e/ E6 g( T3 c
cCheck = id.charAt(nIndex); . P) B0 M+ {! C; D( A: h9 T; C' X o+ h
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% I3 K0 Z' M0 a' @ k O) e {
% O2 u) P8 A; M+ h8 T2 b" y: N; j alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); ; Z4 A: e# l& I% D0 v' A) c
document.sform1.id.focus();
1 O1 `5 O0 g% R! k- Q& N return false; $ B: G' ?% ]' a3 R" `3 R$ J) p9 h
}
8 j% s3 G' X! j m }
# ^4 r6 O8 q: \ chineseid = document.sform1.chineseid.value; % N% B* o- ]$ b. q' l; z5 T
if (chineseid == "") % _: S I9 p* C$ G o5 H: E6 n
{
7 X& L7 ]# Z+ n0 ? E( t) o1 ] alert("请输入中文昵称");
: T; o- ^( \/ Q& _! l5 @/ n document.sform1.chineseid.focus(); ) L7 S7 U1 h4 ~4 v* m1 T- ^
return false;
) @9 j- b4 f4 ] G- g, P) K% R }
5 ?* P5 `* y$ r7 S& g% ]4 K password = document.sform1.password.value; : @8 C. F7 i4 \
if (password == "") . Q/ h8 A: C8 ^- L
{
! a& E; ^) ?, h alert("请输入登陆密码"); : W) d# L4 W% m& D* o1 t$ b
document.sform1.password.focus(); 5 ~6 z4 n* K1 K$ G
return false; " K% y- \4 k" l
} 5 C* w t2 F- A" [/ G: T! h
password1 = document.sform1.password1.value;
2 b7 w3 R% i4 T1 f1 M& v if (password>password1) ; S' z Z6 p8 V) @7 l* I
{" O% N" m" O1 I$ M6 f
alert("重复密码与登陆密码不相同"); 7 _8 c' P6 @: K, j
document.sform1.password.focus(); 5 V4 D# K0 V1 \ ~/ a7 ?, R+ A
document.sform1.password1.focus(); ; X% A8 L: @/ L E/ _) }
return false;
( C/ c9 H) N/ Z Z7 @+ E& Z } ) Q) A( o; c. N3 H2 ^, I6 m- {
if (password<password1)
S9 d H6 X! r8 h5 | {
" P7 k8 w$ ^7 I) i, g alert("重复密码与登陆密码不相同"); 3 x e. u7 v: N, q% i3 Z: A$ N4 `
document.sform1.password.focus(); $ q9 n# }, C! J( B! h
document.sform1.password1.focus(); ) J/ E/ D: Q+ a* {7 Y3 K
return false;3 ?! L0 P" v* \( U( O, `9 j/ S
} 2 R6 h+ U* A' a
if (document.sform1.email.value == "")
8 ?/ ?, G) A7 J3 w: ]6 g* c% h { \( y( B/ E9 H! d( R* m
alert("请输入您的E-MAIL地址"); # f) _* T# j- y; M7 m* E2 _% H% x @
document.sform1.email.focus();
8 X1 O2 O4 N# A5 d4 Z/ d return false;
3 o. }, u- ~5 b$ _. _) y m s } 2 f9 C$ p9 Q$ j3 b* T- x- l9 y
# E1 b9 k; f, k; u) D! B5 O3 S
email=document.sform1.email.value;
8 A& a' J& a7 V emailerr=0
5 j) N {# q( ?. h for (i=0; i<email.length; i++)
5 n6 H. R8 [5 f) p" _ { 1 u+ a$ i$ L/ L# W! y& P2 G! b" a2 |* l
if ((email.charAt(i) == "@") & (email.length > 5))
, M6 \, Y4 S) U. H* ?- x {
0 y! O, e7 S7 E" G, r2 [ emailerr=emailerr+1
; h/ U$ F t2 U6 o9 f } ! D1 i2 m1 ?! [6 D* d
}
" v% G- d3 f" u if (emailerr != 1) . T* T$ E- Q$ x: ?% x0 f
{
, [% s8 s# y1 N; B0 ~7 t* ?0 K alert("请输入正确的E-MAIL地址");
8 B e1 W. H* B3 Y N; M3 C3 ~ document.sform1.email.focus(); ; ]2 g& E) r8 z; W( G4 }
return false;
M/ d0 C2 Q6 M } + X5 b \) e8 {8 A1 D. U4 Z
8 [) {& U; p& v2 S7 e$ D: H( ^ if (document.sform1.checkask.value=="")
# K8 V; W4 K% B& v6 I6 ~ { % T3 ~% ^: U4 A) i5 W
alert("密码提示问题不能为空");
/ z$ R' w6 i- {/ j9 g/ g2 ? document.sform1.checkask.focus(); " Q s4 |9 V5 z4 ]
return false; ; Z9 t" Q; F0 w
}
1 _% S5 F# S! i$ l if (document.sform1.checkans.value=="") 8 z! _& d! O9 i/ \# R6 _
{
; ^0 P* n2 X" y. a alert("您的密码提示问题答案不能为空"); . I% {1 Z1 S/ d* D
document.sform1.checkans.focus();
" X" V" d5 ^3 R0 u return false;
0 U) y0 M$ j; @ }
! E a' r9 }$ e3 K4 M! _8 M) s return true;
" c9 U8 Y6 m! F' N! ~ . [" A- Q+ @- ]
}
( }( O6 E/ |7 x `* [7 w- e' [</script> |
|