|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14385
- 金币
- 2478
- 威望
- 1647
- 贡献
- 1426
|
这个脚本对你可能有帮助:" A |( g) K& f. V
<script language="javascript">
- l; J! y& F; w) W; Hfunction IsDigit(cCheck) & O/ ]2 r/ X' X8 {. g2 X) W2 \3 [# Y& J) P
{
5 c2 R+ O$ w: A9 k- n return (('0'<=cCheck) && (cCheck<='9'));
2 d" O. O. `" d% s } . N7 a( H- h; a% `9 }$ k
8 O. o; o- s/ Z$ q% F& t4 |function IsAlpha(cCheck)
/ z( N- J3 I' ~; G3 |$ d# @; N) P {
% o" I* o* m: S% t return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) " d7 m& V+ g1 W6 J x2 L
} & S" C0 u, }, t" U
; v% \0 y" D/ v8 N$ p: p2 t) N) I
function IsaNull(cCheck) , n# r$ j: ~. ^! e+ q7 n, R* i7 {
{ 8 Q: |( l7 z5 A" I j' M: f) s
return(cCheck != " ") ( |+ b9 u1 k2 F2 ]% G! c1 V/ n' p
}
/ B# o8 c) V1 ^: e C2 H' [& h$ v0 L. f! K
function checkform()
; R0 E1 I+ N0 m2 U* V5 [{ 9 Q; o2 N4 V1 ~5 b. J
id = document.sform1.id.value; , X7 ?, r! R1 @/ L+ S) t
if (id == "") 7 k, d* V ?, y3 O$ H
{ $ a' h9 b [4 B
alert("请输入注册名");
8 {3 j2 t* H# C6 W4 B2 ?! K document.sform1.id.focus();
4 f( r8 \1 X% C return false;
_: V6 G' H9 U+ f1 [ x }
3 ~ a' \& I9 ^7 }
8 ~8 g4 b5 ]8 w5 s1 W8 J for (nIndex=0; nIndex<id.length; nIndex++)
! x7 m5 r( ^6 M { 3 o6 m$ v8 n; P3 O% j+ a
cCheck = id.charAt(nIndex);
8 u1 g/ B, l2 y5 a V- x if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 5 y( n2 ?7 g/ i5 |# n2 ~$ |
{ . O. @8 V$ u) n! M
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
* h0 V) Q. d$ q5 g' c; \! k* R, D document.sform1.id.focus();
* k8 M' i/ u, _; L8 r- V4 K' x6 u return false; 6 N( f" G- l/ F! l; D8 g
}
0 [, a% @: P- i* g, h9 j' B }
! L( [1 K0 J3 o6 n/ ], V' ?5 c chineseid = document.sform1.chineseid.value;
2 G# q0 G5 d* S3 u" r* p2 u% | if (chineseid == "") ! D! b7 e5 y. \" P2 t7 s
{ # Z; U8 ?5 k, C/ L4 [" @/ x8 r
alert("请输入中文昵称"); % g, r& a2 B# ]7 n T
document.sform1.chineseid.focus(); 1 p- {+ S9 }. q, V6 M
return false;
( A, e6 V1 w" a; M! v3 y/ `# r }
. A" w6 j d) i4 P/ D5 t password = document.sform1.password.value; 4 N5 |; }0 Q) B" I1 h+ ?" T
if (password == "") * u3 o* p; Q, X
{ & y. C) X8 t8 P7 w3 `
alert("请输入登陆密码");
: |1 k1 J& [/ \1 U! A document.sform1.password.focus(); : H( T: x# A1 W: B0 s
return false;
- Z+ R! h% g1 A' m }
A5 r8 h! U/ d" L r1 V password1 = document.sform1.password1.value;
* `* H! v+ F( Q; C6 `2 g if (password>password1) - Y' x) d0 }% m/ t8 t
{
J% l& k; T. y2 X1 C# ] alert("重复密码与登陆密码不相同"); & Z. b+ N: o2 }, @ d
document.sform1.password.focus();
) }6 T; a$ C' R z& h- L! p document.sform1.password1.focus();
. l' ] F, r( ]; ~) l/ W return false;
* p2 k3 w ]% z% ~7 J }
! v5 q' U/ }! W, Mif (password<password1)
- m7 x3 U+ R% H. f {
7 L( V7 B& E1 ?/ }4 i# \ alert("重复密码与登陆密码不相同"); 8 n" X! y# K3 ]6 f0 w8 B
document.sform1.password.focus();
( L4 t! e8 o( x' d document.sform1.password1.focus(); ( s/ |6 C* ~3 \0 _
return false;
; Z: q% I j: ?' g } ( d! g' f0 P2 a& Q6 c: H* Y
if (document.sform1.email.value == "") q4 ^# O! M2 j" [4 Q+ e9 v; l5 P
{
# C6 d# n- V& ]4 @0 M9 f* v alert("请输入您的E-MAIL地址");
# Q/ A% W2 i% h, v document.sform1.email.focus(); 4 H6 K/ Y% \$ B* J* a
return false;
. ~2 Z5 S( g0 S9 I- l d0 \ } % s/ v8 G3 C$ _0 l- [
6 \( k9 c) I0 E9 |' S3 u email=document.sform1.email.value;
/ r+ t! R' x& i4 `7 z emailerr=0
; X4 I5 V. @) f: }* F9 G; b4 t5 H for (i=0; i<email.length; i++) - n5 D" C% t4 d4 k5 X
{
- w, G. v4 l' E) r+ u! P if ((email.charAt(i) == "@") & (email.length > 5)) - X& g( V/ y7 D. U! Q, P
{ ! |& |# x" p$ r. z6 v1 \
emailerr=emailerr+1 4 |9 Z$ A1 B: U, _1 F/ l* v
} ; G0 q! r( V; D, S% l5 N
}
. G4 u1 ?+ p0 m7 e' B2 G+ K' Z" w if (emailerr != 1)
5 u2 N# i# @+ A% i$ e( J2 Q {
, d" U! w% R" U alert("请输入正确的E-MAIL地址");
# g6 z3 L. o' R" ]% M' B+ C' B" { document.sform1.email.focus(); & V& q% Y$ o6 }% j0 ~3 B4 X! ~
return false; + M! H3 w0 h" R* E
}
; b0 }* l2 L) g: u2 b
0 t! y+ y7 C F: l! w1 |: N7 W if (document.sform1.checkask.value=="")
1 ^2 ` Z1 |9 x% Y( \4 U) h {
+ @0 Y; U+ D8 h( z alert("密码提示问题不能为空"); 2 y$ O6 Q& t: t
document.sform1.checkask.focus();
! ], v" x, L/ R0 \. E$ X6 j return false; 1 m* ] _) M. V5 Z! R
}
. j2 c% y% r: z1 ^* u9 ]9 n if (document.sform1.checkans.value=="") ) I, D5 S U+ d8 i) ^5 S
{
6 T- Y; z0 U- h: w/ X alert("您的密码提示问题答案不能为空"); / L7 i/ {" S; ~' ^
document.sform1.checkans.focus(); ' @/ E; h& N0 P- B0 |$ Y! ?& O
return false; 4 \/ H/ X9 @( Y/ X" i
}
9 Y* S& z* d& m$ y0 a* D return true;
7 E/ L; U& z5 l& H6 {* K. h2 t5 |
2 i6 y7 ^# M5 U0 L8 X$ P}
3 ? [8 \. B, o3 v( V" P/ o</script> |
|