|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
这个脚本对你可能有帮助:
) I: G) [) w# z% C1 l5 `, t+ h, _<script language="javascript">
2 q% c, D$ }0 e1 K# ufunction IsDigit(cCheck) % b+ z k% y! J8 Y% R
{
2 ?7 \9 q i; H. J( D' [, f* G7 g return (('0'<=cCheck) && (cCheck<='9'));
7 n/ v9 I$ l1 J" c" Y- S6 a! u }
@) N t$ o# x 4 t }( e+ z4 j3 _# S
function IsAlpha(cCheck)
+ Q, ?" W" L* |/ t; v. Z2 W( o, i {
8 [5 w9 W* C4 L, s3 G' Y: @ return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
0 C, v% V- Q3 ^4 Y } ) ~" o5 G6 |& A: r- _
9 n+ [, Y. e6 R: z& Y) ?function IsaNull(cCheck)
. m- B/ B6 s6 ]: k) @- Z { ; w" k8 Z/ d, c5 e2 \# W7 h5 J' p. V
return(cCheck != " ") 0 h, r8 u" W7 E
}
) e3 |* C' r) l; H. u
' z4 C8 g; H$ T" {0 }1 Kfunction checkform() # h! ?- P$ u5 a$ s
{
' q3 J, q m } id = document.sform1.id.value;
/ ^5 l& F2 O5 H) y if (id == "")
4 r7 D; ?% i5 Q# y7 Y { & i: X. \9 W3 v/ N9 v8 H
alert("请输入注册名"); 7 F$ c i/ Y# t; C+ Z% E
document.sform1.id.focus();
0 W2 \9 s! S- z& h3 u8 x8 X5 [& k return false; & {# n3 S! F) J! F- S
}
+ K! P5 F! d# L) ?; C
/ d2 H8 x- C. c for (nIndex=0; nIndex<id.length; nIndex++) 2 F# ~$ w7 y! x* d. T) S$ s; ^
{
4 r, U8 j5 m( q' I- g cCheck = id.charAt(nIndex);
% ~! y3 I: K9 _ if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) : E) H+ a: |3 |4 K, @
{
% W) t0 `4 g, ?- m9 c alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
' v6 g) ]# L- y( V/ E+ M document.sform1.id.focus();
/ n1 F/ n+ i7 u o. N. P return false;
( @6 Y$ G# P$ y- h: H } 3 t5 Y s' {% ]5 {+ r, V
}
) n" m5 ?5 ~! ?* }, y( x6 D chineseid = document.sform1.chineseid.value;
* ~" H* K1 Z2 G6 \! y7 U/ ~ if (chineseid == "")
8 z$ k/ l0 G1 b) c {
4 R1 O; o- k% e9 C" L# U1 e alert("请输入中文昵称");
8 o* }5 b+ [0 e* T" W" S5 J document.sform1.chineseid.focus(); # x& g- b. b0 h8 u
return false; * K* j1 f4 X `: I3 l. A
} e3 ~( B" X/ @% p2 E& e+ {
password = document.sform1.password.value; ( R7 K- L9 m) ?9 y) U
if (password == "") " M& R) V5 Y* `2 q! ?
{ 6 `% r8 i1 |7 m7 v- J2 V
alert("请输入登陆密码"); , P* X: \" J# k7 U
document.sform1.password.focus(); ( I9 q0 H+ x' }3 T
return false;
3 J% [3 A9 o# O& N- e. V }
: D: M/ H3 Y# {1 B4 |- w" t; b password1 = document.sform1.password1.value;
. Y- J) K/ V+ ^! u. I% v' w if (password>password1) : N' Z; X( k- ~1 T
{
2 x0 W0 h9 o( ]6 |. }+ c, f* }$ Y alert("重复密码与登陆密码不相同");
* F/ s6 k) J% C: _ document.sform1.password.focus();
4 M: K ^1 T* j* e j& ^& Y$ p document.sform1.password1.focus(); # ]* M& u0 D1 [
return false;5 |9 L# l$ X; C, H3 \) d
} 0 H% k1 ?! ?4 o9 H
if (password<password1) " [3 P9 A# Y+ x( X0 ~1 m8 `
{
: n' w- Q! q& i: U6 }% {' Y alert("重复密码与登陆密码不相同");
9 l4 o# c% \- y( a document.sform1.password.focus();
l' n& [& Q- R& q3 }* X. ]% K8 V; u document.sform1.password1.focus(); ) D2 l- I( W& W$ y
return false;
/ T" g" Q' |. D }
$ ^; L6 s( r+ t$ ]8 D2 B if (document.sform1.email.value == "")
: @* a$ @" D- L0 r { 9 j7 V) z& q; U9 ^
alert("请输入您的E-MAIL地址"); 6 |2 G/ ~. }% k) l+ S5 B2 `
document.sform1.email.focus(); ) a$ S$ K; b8 w- M
return false;
( e3 l9 {$ f7 E8 T% N } 2 l. \+ o! |8 o
, Z) I }; B/ ^3 g3 @7 x
email=document.sform1.email.value; 8 L4 n8 j% n% ~$ ]" b/ P
emailerr=0
$ {! w v2 z2 }3 ] for (i=0; i<email.length; i++) : a9 i. M$ h% C" ~) W6 C* n
{
$ r o! w, T2 A, Q% i' H if ((email.charAt(i) == "@") & (email.length > 5))
% ^. j% {% X9 w1 c% `, I* m7 w { % P. ~4 |% G/ I; E
emailerr=emailerr+1
t O+ s( U+ } }
- s6 \; X# V. Y/ c* {1 s1 u }
5 S. c1 ^' ]) k0 Y1 n4 d8 y' V if (emailerr != 1)
# o! [5 A$ f5 h( a {
9 _7 U Y* d0 i- p `: a alert("请输入正确的E-MAIL地址"); , N' D; C+ |, Z# D) e. W
document.sform1.email.focus(); # W0 `' L, \8 f u2 F
return false;
$ `0 c; Z3 O1 V6 ^: p s4 F( U | } 7 h% M K5 \9 u/ V: N' s% S& A; @" R
! S6 D0 a. V( x& K; ^3 J: e+ y7 B if (document.sform1.checkask.value=="")
& B# w+ m2 Y# p$ C/ ]9 T; u { 6 M" n! e4 ?* U
alert("密码提示问题不能为空"); : [. q9 N. d; }, c c
document.sform1.checkask.focus(); / _+ @5 h$ b: t2 d
return false; / Q- Q& R# s9 ~; B$ v
} 2 I" y! n5 h8 p6 j' {
if (document.sform1.checkans.value=="")
9 n0 f( n0 E4 A+ t" D3 L \0 S { 3 x5 x; |1 R8 S6 o: R" ?
alert("您的密码提示问题答案不能为空");
7 Z- P9 S9 ?) E: M1 @$ g document.sform1.checkans.focus(); 1 t* F0 d4 h$ h) y
return false;
! u4 H6 P; C+ R }: g/ S4 K% N- Q9 p: U
return true;
' s7 K! y! G+ ~
; l: ^" N/ W& a' S}
4 l3 s4 b8 ?" [" s' } H7 y/ \</script> |
|