|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14317
- 金币
- 2444
- 威望
- 1647
- 贡献
- 1392
|
这个脚本对你可能有帮助:1 y0 o' _/ V; z& F1 D% k6 H; p
<script language="javascript"> # O4 g6 t# e$ {
function IsDigit(cCheck)
$ E8 Q1 ~. N! G$ a- E: ? {
+ f% z+ R/ l; m/ L return (('0'<=cCheck) && (cCheck<='9')); + C, {) F# d8 s& Q: K
}
8 N- G7 q+ X# `, ?4 v h* N: m, X
4 `1 R9 ~% g- r. A# `function IsAlpha(cCheck)
5 F- P4 u6 q/ s8 Q# d8 G+ h# Z {
: R( ~+ ]/ ~* K! T0 B return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
5 b5 P; p+ o" j! s- m } G. N" C8 T8 }4 _
0 p- P$ B. R- M# J" ufunction IsaNull(cCheck)
- L/ ?; K3 H6 u7 H9 O# U { 3 c Z9 A# @; s* v4 @( S
return(cCheck != " ")
' u+ X5 z& l' J$ ^- [ }
. Q; U W' V8 F; h6 N7 b" l' E ) }7 y6 y. e) k0 I
function checkform() ) p [4 U0 M8 a) K$ h
{ [6 c6 S7 ~% B; i/ w" F) V) w. @6 t
id = document.sform1.id.value;
1 ^( j! \! Y; @# w if (id == "") * [" X4 G% E$ \/ F/ v# d6 R5 V
{ 6 g7 m* \2 `* F, U2 ?
alert("请输入注册名");
9 L2 N. x" t/ I0 u document.sform1.id.focus(); 7 t5 w W, c' j* L4 y; G7 h0 I
return false;
; k3 |7 x2 O5 C- o }
) K, V( g# h% f0 q5 |% O 9 O* U# e+ d. W' \
for (nIndex=0; nIndex<id.length; nIndex++) - ^ \1 I" Q2 w7 i' N* o
{ ; y1 k, X2 y" i% B! C6 |
cCheck = id.charAt(nIndex); 0 ?" C1 \5 x2 [' j$ ]
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
. |" W W; f% q- b5 f+ Q) k0 R { # P b& h) _7 |% V' [5 x1 u5 w
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
6 j& X) o- T; i& G document.sform1.id.focus();
* _ C& J" P9 N5 s return false;
, w3 v% k; m/ D( o) b* w0 T- ^6 f$ d }
+ @ g5 `. M! a6 R/ a }
2 i+ i1 h( I) i9 T3 Z5 J, Y1 ^ chineseid = document.sform1.chineseid.value; w9 B( p( W$ w6 x
if (chineseid == "") & K$ ?4 A* N: _8 m) l& M2 d
{
) {' {% {6 l! a8 W- T+ u* A alert("请输入中文昵称");
8 z4 u7 S: p1 W5 Y3 n4 ? document.sform1.chineseid.focus(); # L$ \! d9 J' b- K) G
return false; - u' d" ?% J0 J- F6 |9 S! ], I
} $ y( U- S$ i. P1 y
password = document.sform1.password.value;
& h; }8 ~% D: m) Q4 l if (password == "") 6 O% ^ `; m( H9 ]
{ - `4 I5 N7 o: a J, }) j
alert("请输入登陆密码"); ; ^7 s" i5 b) }# O' o S
document.sform1.password.focus();
+ n0 L# U2 l: V" A return false;
. j$ M' L& X; }+ H6 r# b }
2 x( T! m' y, ?' I! \6 V0 e# L password1 = document.sform1.password1.value;
! ]2 B! } b0 y& t! ?: S/ f9 f if (password>password1)
. |% m4 H% j* i4 _ y. L {9 ]' i% U( A0 [6 M
alert("重复密码与登陆密码不相同"); ) z$ b& D, j, g V- t- r" D- v
document.sform1.password.focus();
+ L( Q* ~' ]& `: B/ C$ ^* A; b: X document.sform1.password1.focus(); 8 b! I7 c+ H, i+ ^9 l- Z& R. N( z
return false;
$ M; v0 {/ j' M5 {# A }
* p w. k1 s: s, }if (password<password1) ' o s5 D) V) s* }. W! s
{
; H* s. \! x4 Z+ @) r alert("重复密码与登陆密码不相同");
! _- n& a* s& _. V& y6 ?) m document.sform1.password.focus();
; r( B+ V: Z2 B% ~0 N3 ` document.sform1.password1.focus(); ' N- N" |; c$ |( k! ~
return false;
% `" o% Q1 k- L7 a% E } ; ]# X/ g; z0 \6 q9 H* B
if (document.sform1.email.value == "")
$ D$ ~' A9 Y$ ]( v3 o: R { ; j1 ?; }% u' Q" `# Z+ A, c
alert("请输入您的E-MAIL地址");
$ Y, R, B+ l) K5 u6 _" E8 r document.sform1.email.focus(); ( k4 [5 J* K x) S
return false; 7 G9 N; n* w' o. ?, D# |
} , d/ g& N# A+ @0 F. `
5 r' }0 K4 J" ~) x }
email=document.sform1.email.value; 3 j% b9 Q. p1 W0 Z" o2 n# z8 p: \2 {9 [
emailerr=0 & c. Z" N$ s+ X4 @
for (i=0; i<email.length; i++)
1 ^+ J2 n* W: f; ~' i4 S/ I {
6 e& u' v+ x3 J' a" c2 q1 n1 o6 U if ((email.charAt(i) == "@") & (email.length > 5)) 9 l- K C% Y. C4 c S1 `
{
3 c5 x* d F1 h+ ^: K0 `* q emailerr=emailerr+1
- c( c( V; q5 K' E& f! P- I }
: {4 ]" `, i1 K0 n. |( l } 7 e: L0 B7 N7 }) ?
if (emailerr != 1)
1 T% ~' V Q+ \( }) P) y {
" k1 u2 j( I _) _- [& [ alert("请输入正确的E-MAIL地址"); : s9 X$ c: o" P% n) U
document.sform1.email.focus(); 2 R+ f$ A8 x" U* ^
return false; % L: M7 q3 [# N' d
}
/ g$ z" {& i% H% G; ~2 v) G " w! C% Y; B+ P4 |. z' k3 _5 K3 a
if (document.sform1.checkask.value=="") 7 {. G, i* a1 ]+ a8 A
{ 3 ^: P9 Y9 u* m' m! O, p8 ]/ v
alert("密码提示问题不能为空"); , A, R F3 v& b, h, o8 a Y
document.sform1.checkask.focus(); ' a* v3 j% V9 m( U2 a
return false;
) M+ _# p3 x9 p }
8 _( `7 d9 N) Z% \; A if (document.sform1.checkans.value=="")
5 r4 S* s8 `8 @ {
/ u+ K z- e& Z0 [* V alert("您的密码提示问题答案不能为空"); 2 p3 l5 F% `# M- Z4 `; B3 r
document.sform1.checkans.focus(); V; b$ r5 n0 v7 R8 r% r8 k
return false; ! Y* z6 j2 E( X( ~
}7 n5 A% G: A0 n: s# I
return true; ; l( h! Q# P7 t1 r
7 G6 N3 H# F& n3 u
}
6 {' t; p% O% Z3 G+ ?4 v</script> |
|