|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
这个脚本对你可能有帮助:
0 u4 r* G+ j2 p! O4 i0 A: ?<script language="javascript"> 9 Q/ q/ e. T: ~. i
function IsDigit(cCheck)
' s1 ~0 }. a7 l P- [' Y { 8 _' t5 ~9 A/ c& l, a% k
return (('0'<=cCheck) && (cCheck<='9'));
E" }8 m% B; Z' \" I }
. ~. X1 i& D; _( c" t 9 _2 \ }3 I! d: u
function IsAlpha(cCheck) ( `2 A7 }. S7 s- @ M
{
- m) l& M- F" O; {$ X. H return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
) r9 G) y1 l- I! e& N- S/ ^ } ! c0 G& u) |' Y2 t$ D, D- a
) {0 G" Y" ~2 ~, d% g# `( P9 v/ Z
function IsaNull(cCheck) * B# k$ f$ i7 `: e' V- Q% K
{
" J+ O/ [+ q& m9 c( H return(cCheck != " ")
4 P; i$ {/ |/ x7 Q0 E9 N } $ v2 I# N6 U M( U" U3 e- D
" G5 G. Z2 M4 O. @2 k1 [1 R+ q. sfunction checkform()
1 I) m" W3 g0 x% |{
" s2 U4 t) `3 ^: [ id = document.sform1.id.value; # o. J y* |: n5 ^6 r; i# K
if (id == "")
. l, p& w# ^6 I$ O _3 `9 K { % e+ w7 y# }: n: U+ l7 v) Z
alert("请输入注册名");
3 ]9 {! e/ b* B' [2 s+ T- ]# U/ V% W document.sform1.id.focus(); . H4 O; f1 F/ D; [; n$ c) h
return false;
- m0 X- K% k5 Y; h+ q2 { }
# \6 w: i' X1 J! P5 F2 }" D+ ^% H - D0 Z$ ]$ O3 u
for (nIndex=0; nIndex<id.length; nIndex++)
( ~9 L0 n4 S; C, p* L { ' L) f; u1 e- a" x6 P' {) v
cCheck = id.charAt(nIndex);
: d- ?# f- U" {* e# d if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) . ~/ D0 B [" E s
{
% r9 G. x4 d# d6 ~* o0 v alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
! p. H; J) b: X# g. u; {" y, [ document.sform1.id.focus(); ( s$ N" N" E& y" c3 }
return false; 8 S& y& I8 l1 K$ B: l
} 8 C( T& L9 E. Z# l8 y; }
} 5 K$ I1 \; N9 d+ ]
chineseid = document.sform1.chineseid.value;
2 E" s, _9 z$ X& r/ f; E if (chineseid == "")
* D# }2 J$ }+ ]# k7 @ { 2 X, ?5 d, h( i5 h2 r% `
alert("请输入中文昵称");
1 S$ ^' |3 D7 U, q document.sform1.chineseid.focus();
7 V n" T- w) x return false; ; d3 \* L" m+ Y* M
} - V- m: X p/ Y! }' ^, G
password = document.sform1.password.value;
9 i4 N4 `! i) K; Q( m7 w if (password == "")
/ h3 {: T( t7 g. [; s, D$ u {
4 C( h3 U7 E4 U$ @& ?3 y& Q3 F alert("请输入登陆密码"); 6 w% Z% O& P/ b! k: S
document.sform1.password.focus();
6 m" m3 g* v- N0 o J return false; $ u/ w% ?# D" Q; m0 `7 j; V$ I, p
}
* Z0 l$ a4 \: x password1 = document.sform1.password1.value; 3 K' t4 s2 P: p6 I3 U
if (password>password1) 7 F/ N& U* D( r7 b! J4 {- p5 `
{
( B/ F6 Q ~% P4 r g alert("重复密码与登陆密码不相同");
9 @& E* i! Z {7 M9 O7 a: s document.sform1.password.focus(); % C% F+ e8 Z5 m" ?5 D* r2 {& G/ j9 z4 v
document.sform1.password1.focus(); % `0 l7 D8 ]* L) ~+ ^6 [
return false;# m+ ^* s8 I9 D# L3 I' q" z
} ; x" G- i6 Q, b0 Y$ [9 R
if (password<password1)
1 U( S0 g# B# L9 X0 l" U2 T {
: T7 L/ f; S) z& q; O% x! x4 ]7 I; s alert("重复密码与登陆密码不相同");
( m2 T; B3 K# ^* N& y& P document.sform1.password.focus();
9 u, a' h1 G5 s7 ?4 c document.sform1.password1.focus();
' Q8 D2 g7 B, y9 Q( {/ O return false;
1 h/ W- N6 m3 H m }
4 \0 R4 S0 s9 |' s if (document.sform1.email.value == "") + b4 }6 i+ ^' k/ W- Y
{
. j Q- t ^# x+ T+ w1 F- L. r alert("请输入您的E-MAIL地址");
; M0 H! O7 F" O5 S3 @ document.sform1.email.focus(); % S/ M6 h4 S% N! P8 F* ~
return false; $ b2 C& n% A+ t# D$ ^" u
}
5 b$ N* D* S$ V! I0 @
, j4 X2 l6 Q( g+ b5 N0 y5 K, Y) m email=document.sform1.email.value; # v b7 Z" e8 O4 ~8 X
emailerr=0 . z8 |2 Q/ a& h p
for (i=0; i<email.length; i++)
/ Z6 V' a. h* K; u9 L {
& g# z3 u9 w* G2 T) M( @" E; ^1 } if ((email.charAt(i) == "@") & (email.length > 5))
; D4 t2 n* w+ k8 o2 K+ X# ` {
: Y/ O* _. T% B. o6 m2 z% c& Z& c emailerr=emailerr+1
& C1 _8 `0 b7 \8 ~ }
7 R% ^; U* ?6 P( L } * M& t5 H& C3 k% o3 u5 `
if (emailerr != 1)
/ y2 b2 z( B9 ^ {
. |7 ]7 G2 b9 ?/ v* W& s alert("请输入正确的E-MAIL地址"); 1 u% K& \$ ~, U" s9 I7 m4 x" i
document.sform1.email.focus();
. w& z) U* R7 _$ ? return false; $ V% _1 _/ p3 a
}
7 m P* F3 a! g' u2 w
3 F7 L. n8 A( _8 g4 r if (document.sform1.checkask.value=="") % p! T5 E: Z( Y( B3 e% u" o9 |8 }
{ / z# C" a* s* y# r) A0 p |1 ?/ G
alert("密码提示问题不能为空");
0 N( e" {6 y. ?- B- G7 M document.sform1.checkask.focus();
# k2 N+ ]& r' |% \) b* M return false; ! e- E' {' V* ]0 \8 i5 \( O! V4 `
}
$ L8 R' h( u0 i d if (document.sform1.checkans.value=="") 8 M) p! j& o5 P* K
{
- t, c. d4 p% s( s2 k) D' y" L. ` alert("您的密码提示问题答案不能为空"); + N: o" H5 J5 ?1 u! j1 G6 Z5 E- r
document.sform1.checkans.focus();
; @) v1 t2 a- L& @5 |! ~ return false; : e E9 n7 T% H7 p; n" b0 t! g
}# e) k9 V: }1 m7 ?
return true;
; p8 N( @5 i6 b8 M3 J
r0 k2 y" N0 o3 Q}
* F/ q G: A6 l( @</script> |
|