|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
这个脚本对你可能有帮助:8 @+ l+ ^7 d% ]
<script language="javascript"> ( \ K8 P4 s" f5 h8 S
function IsDigit(cCheck) ; C- g8 m' k# z0 v/ @, q
{
! w3 w: L$ w9 O, c0 ^5 p return (('0'<=cCheck) && (cCheck<='9')); : ~+ s! g) l$ W! Q2 r2 ~0 v
}
4 E3 S: W, I& W, ` . k* ` n: E! f& D- F/ P
function IsAlpha(cCheck)
4 ~; x# V4 V0 ^1 l. S L" j { : ]4 o; Z' X3 G/ k5 B: G
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) % V* h; E6 J7 o) i
}
& G* ~7 l" ~6 a$ M6 g/ |
' O; L; R2 Y8 k5 p' _9 @2 H0 `function IsaNull(cCheck) " x7 T* Z; }8 w" Z( |3 M# x
{ 2 J- a! u, K) @. i
return(cCheck != " ")
- j; y1 r" V( I" o5 m3 R* e }
7 D: d/ F9 e; ]# _) Q) H 9 w6 X3 t. A) K$ l
function checkform() ! Z6 L) e( W( K# F: u# |) w: K3 ` V' ^; ?
{ 3 L4 o: {- T: H9 j& V
id = document.sform1.id.value; ! N& i' U% ]/ U# H3 c a
if (id == "") . o# |2 ]) F1 L6 D1 s2 z" `2 O
{
' K) [8 w) ?/ ~1 i1 Z9 C: v alert("请输入注册名");
( N7 ?* A2 p/ H4 L6 _/ r+ Z document.sform1.id.focus();
9 r& U' d* v" w5 s. C return false;
7 a; | i% X2 G! \9 m2 p0 ]$ D } ' s1 q0 y8 u/ d/ Y: t) O
- _1 k! q0 t5 M4 D
for (nIndex=0; nIndex<id.length; nIndex++) & I% W2 [4 J8 D0 t" \: u: F
{
& \: |4 k! \ t9 j# } cCheck = id.charAt(nIndex); 6 i, k" E' g' |7 v
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) $ F3 O0 w1 U) ]2 N$ E; y
{
/ [4 S, ~) c( \5 N: d& K6 H. g& c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); & P" k2 ?3 f/ G" ?3 l
document.sform1.id.focus(); ! G7 S! ~% v6 d( H
return false; 3 o# m1 \6 u" x5 ]" w
} ' r5 N3 _* X0 P+ Q
} 6 P' R2 z2 ?4 j% x+ h* J" _ X6 Q0 o
chineseid = document.sform1.chineseid.value;
3 E ]8 @8 ^) t if (chineseid == "")
+ o K- Y$ `# p" |: B8 C2 I- Z { ' y4 W* b, a2 V+ S# V |5 H$ f
alert("请输入中文昵称"); 7 Y( D+ b/ g1 x6 a1 B0 L
document.sform1.chineseid.focus();
) P/ c0 S0 N# q( ] return false;
$ }3 Q$ X1 L ?7 L }
! T' n6 d3 l. w4 M, {4 U' h password = document.sform1.password.value;
: y$ I% ?3 P! Q if (password == "") 5 U4 _1 J5 A, s& Z% F( g m; L. d# R
{ ( e4 u( q) q" \3 M, l' N
alert("请输入登陆密码");
$ Z8 x; P2 s5 z+ `6 ]- E/ F document.sform1.password.focus(); / b- ?2 w. i, W ?
return false; / Q9 _' y4 A- b1 q; s
} 6 A* m# Z: h: D" {) o: w; ~. z+ ~
password1 = document.sform1.password1.value; ; K# W! L! [, u3 b. c
if (password>password1) 7 r- N# F2 x' y* [4 H
{! h X a8 @; H7 f+ Y
alert("重复密码与登陆密码不相同"); : |# n( ]) T7 g; x* X: H
document.sform1.password.focus(); 6 e! J0 i& f0 q. r: T; y
document.sform1.password1.focus();
% Z: u( X9 a5 D- ^ return false;
! H ~3 P% {) [, D, o } 1 Y0 n; v/ Y' N* V7 H) u
if (password<password1)
: y9 p8 G! v2 ]$ ?4 \( g1 e) A {3 o& b3 t; [$ C4 ]6 A
alert("重复密码与登陆密码不相同");
( U1 X+ J2 b6 [" Q/ Y6 u document.sform1.password.focus(); ! Y( P0 C5 t4 C( p9 w
document.sform1.password1.focus();
+ [4 @0 F! R9 k) G4 | return false;5 f" u* E n* n, m! c' `, E
} " k; S2 x. J- S$ M( N6 | c g
if (document.sform1.email.value == "")
/ M& ~) c- }! H9 T { ; ?: @6 l: M' C9 a2 j: a) I/ D
alert("请输入您的E-MAIL地址"); 8 m+ @4 M( ~3 H% y; P
document.sform1.email.focus(); * S3 J; d- U; l1 |7 M1 n6 R
return false;
# a3 ?( m/ g }6 A } $ S% E2 m. m/ F" p+ {
8 K1 Z/ {0 s# H3 l1 Z) G email=document.sform1.email.value; 0 O; D2 S6 ]; K; `: _" u
emailerr=0
3 p/ u+ L& s( W* Q! B% a for (i=0; i<email.length; i++) / \' m* r( d4 y/ [8 z& D+ T d% ?
{ 4 h4 i1 R; y2 `6 O
if ((email.charAt(i) == "@") & (email.length > 5)) 3 C% I: q0 }4 i7 Z% e- @
{
3 ~- w1 G" t/ A/ b emailerr=emailerr+1
- I8 J0 Q7 C. W1 T: ?- v# Q# ^ } ) u- w2 C' m2 N
} ) A+ s. b0 N8 l
if (emailerr != 1)
/ u% i' b2 q" v3 _8 N. q. O" l {
6 D [* q& a& V' d9 R alert("请输入正确的E-MAIL地址"); 5 d; H, W0 o7 i6 {+ l+ n( {5 R
document.sform1.email.focus();
5 r" b" D7 T S; u3 y return false; ) K, N( r% O: l6 q2 w& l
} a: K( T) `; l9 P. \" d8 @4 Y1 d
8 `! ?* _4 z; a7 ^& e- { if (document.sform1.checkask.value=="") 7 }. {$ h) G9 L v5 g5 x5 s; X
{
! n( i+ |5 A9 O6 P% o alert("密码提示问题不能为空"); 3 d) D. N$ _% {2 ?0 w. ?
document.sform1.checkask.focus(); ; J, @. ]* B( O3 ^
return false;
% j2 X% L5 n1 d3 B) R: c } ' P. \/ z4 j1 c G5 c- v5 g. H
if (document.sform1.checkans.value=="")
8 I& O- x9 G# b' n$ ?* ^ {
" p* Q" E" b) h" e" B alert("您的密码提示问题答案不能为空");
: C+ z1 G7 t4 `% u7 A& ~: r document.sform1.checkans.focus();
' t. ?% [- x/ O# a7 y; t( t return false; 6 |2 V. f3 j7 l5 h4 [
}+ V' w4 S# G) c" T' s- H, }
return true;
4 C/ H Z# Y8 M 8 _+ m: R5 t: f
}
0 G8 J( k- E& K9 c0 f8 q</script> |
|