|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
, }# i ]+ [5 r/ _' R5 P<script language="javascript"> % v+ s$ D$ o a) J! ^+ ] I2 ?% m
function IsDigit(cCheck)
6 I" j+ x& t( _, V. E { + r+ b7 L5 Q6 a' B( ~6 q' h
return (('0'<=cCheck) && (cCheck<='9')); . i: B. t1 N# I9 `
} # @! _! ~. o: y% s0 z
. J* ~2 k/ ~0 i6 j8 Rfunction IsAlpha(cCheck)
; k# m; h( y' S N { % F* X V0 p) J7 K
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
$ N' p- I3 R/ y- G5 f7 A4 I } 8 b% i5 P- ?1 u! S6 ^3 ^
9 ?& ^ s# Q$ Z% }5 h' z K" ~function IsaNull(cCheck)
; o: i. |- k! n# d4 n: j! k8 k( A {
) t P% v2 Z$ l7 m return(cCheck != " ") # y6 e M# q, ~3 F- g% u9 m
}
- l P! y; ]9 Q6 e4 @1 _& ~
& r# ]! x! s1 K, tfunction checkform() ! U: k8 v% J, e9 h! W$ [9 o# `
{ - v6 H0 G% e+ h5 a' _3 D6 K
id = document.sform1.id.value; ! i. ~* a8 }$ Z _, d
if (id == "")
/ U3 X) k; @: I- D {
: `) p& ~6 c' [0 j alert("请输入注册名"); ! U) j* k, N' }9 U) _
document.sform1.id.focus(); , L$ u. x# C% ^% s) u# ?
return false;
& i) i8 f+ H* k0 R' q } 8 g+ |/ V% N2 o+ ~
& y; Q* D5 F! }4 p
for (nIndex=0; nIndex<id.length; nIndex++)
1 E! o& [) i4 H$ S& I- e# E {
0 j8 J* t! D' c- H- q5 i! \% w. {7 g. n cCheck = id.charAt(nIndex); $ I1 C4 n4 D/ B, B; m: F
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
9 v! D0 ]7 k; ` {
. z. Z5 n% q0 ]8 s3 g) s/ p+ E alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
3 A3 Y; h" b3 V9 A4 G; X document.sform1.id.focus();
, a! K' F2 F" Q3 O0 L# g return false; 9 w2 o% t) t$ c0 l- N5 x
} 2 u9 l5 N" G K7 e- D
}
9 ]( o9 G* G; Z+ p. L) l% c) Y2 q chineseid = document.sform1.chineseid.value;
1 h/ f3 S: y2 K8 D0 j if (chineseid == "")
% X$ \" _. v( g7 H. a+ K { ( P2 i1 O* V" g- K2 c& y- z" E/ Y
alert("请输入中文昵称"); ; w9 t, d4 a1 ?* ~8 z7 A+ E6 `
document.sform1.chineseid.focus();
9 `1 {& M: E$ U/ J; y7 |* n/ { return false; 2 ]- p6 h3 Y8 H! V0 A" M y- o
} + |7 u. R% l' j
password = document.sform1.password.value;
, O% d- w/ k! D, R/ j) m if (password == "") / J5 c9 Y5 _9 t" t+ Z
{ + f/ h( K* o- V8 D% x+ w1 u
alert("请输入登陆密码");
( D# _& O$ N# Y document.sform1.password.focus();
, A; f6 X6 q, ^2 |5 E: }, M return false; 5 F$ A# s& [$ E3 g+ ^* ?8 A# Z: W
}
5 R/ _$ ^# f) f' t! v) T$ a- M5 ^" \2 Q password1 = document.sform1.password1.value;
; H! m' U% W0 P- r2 G. H& G if (password>password1) 6 a! o( b7 g2 y( F$ o9 Y
{
4 f9 A; \1 W- c alert("重复密码与登陆密码不相同");
1 F1 t$ `6 ]0 ] document.sform1.password.focus();
- M5 k e% U+ T, K! X- n' ]& ~ document.sform1.password1.focus();
2 H) Z" A: }* r0 y- b) } return false;7 n0 ]+ Y: h# g/ \' C4 W: g
} ]1 f0 J$ X% S" ~4 Y1 u# X
if (password<password1) ' L7 S% I! A5 Y5 R
{1 H) l) |7 u: l/ n7 X
alert("重复密码与登陆密码不相同"); I; r! A. [+ i
document.sform1.password.focus();
3 G8 b1 B- n$ ]9 G: I! ]; { document.sform1.password1.focus();
5 R! ]9 C1 R4 {: a8 |1 N w } return false;
/ V4 }, _$ Y) l4 ~! j% H } 6 o" i: r6 k f
if (document.sform1.email.value == "") 9 `0 ?* I/ Z/ m( V7 E
{ 5 I$ f8 W3 S. x0 ]- M
alert("请输入您的E-MAIL地址"); : Q4 }3 C W5 y
document.sform1.email.focus();
0 M* B5 i& Z- F* L return false; , L# n& w$ F1 g# a
}
& W( J& o. X2 A% ]8 w' z; k
, p; Y E; ], b# B email=document.sform1.email.value;
. j% h3 Z% A2 Z( R emailerr=0 $ n! ?& j4 ^$ v d# C
for (i=0; i<email.length; i++) ' J5 E- r0 x0 @! Q6 ^
{ 4 U" u5 D3 b9 T: ~# H3 |
if ((email.charAt(i) == "@") & (email.length > 5)) " w- Q. V; K& T* g# W% e/ M
{ # T- o' S& D |5 x8 U
emailerr=emailerr+1 2 S5 v. u. G; r( l J2 P, Z( `) z
}
- Y p4 y X* B8 f } - T7 C7 Q' W! z0 s3 r% M! H
if (emailerr != 1)
+ Y, v( o' I% ^- p: {0 g8 A { , c2 S8 ]' j$ j+ W, d& S
alert("请输入正确的E-MAIL地址");
. ` H! @5 a3 Z4 }, f+ c- \/ R {- Z document.sform1.email.focus();
6 I3 W! ?6 V) e e _: ? return false;
% C, J& F5 p& E; A, b' V }
5 T# J' z/ H1 ]' _
. x( b, ?. y2 k8 [" i4 i' J if (document.sform1.checkask.value=="")
% ^# w( Q! k) B# ~. b0 l6 E {
) E* w/ I7 z6 p3 ?5 h! G# f! e' } alert("密码提示问题不能为空"); ; Q. s/ }2 Z) a
document.sform1.checkask.focus(); & K' n- g: `; h0 H( v) e* I- C1 u( `
return false; 6 u6 V3 N4 [! _
}
) B. w$ v( k: I if (document.sform1.checkans.value=="") 6 Y, W2 ?% E! |# |& o1 d, P
{
/ f- l3 T/ D7 Q/ Y" J' Z/ G alert("您的密码提示问题答案不能为空"); $ q) W9 {5 n5 U- ]) E$ G# H
document.sform1.checkans.focus();
( u0 m8 S5 \) V& W( { return false; & B& b+ J# R& \7 o
}
( o' U2 h* v, g7 i return true; ) P/ @6 b$ o- L9 K# @
5 r" c- i0 a, m( C L# p2 y/ |
}
6 b# t# U$ ?$ |$ }' Y# p</script> |
|