|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14337
- 金币
- 2454
- 威望
- 1647
- 贡献
- 1402
|
这个脚本对你可能有帮助:
& P) ?! [, y5 O# a2 [5 Y( g. {6 {<script language="javascript"> & z4 Z3 _ z) U4 q7 I
function IsDigit(cCheck)
, ]0 _ L' ]5 D; s {
8 N/ y: S* q$ o2 c. g# u return (('0'<=cCheck) && (cCheck<='9')); + ^" ^8 U _* L
} ) u) F& a" W# H. F
# l% M9 W; h( ^9 x5 F
function IsAlpha(cCheck) # b( D: d' g1 @$ `5 B- e( V% Q) M
{ * ~; T2 J$ G: G5 a& \
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) 9 t1 g& @+ H" ], G+ i; X* M
} / _0 {7 i$ g: p' b" k6 j* x5 E
) X$ x9 q6 Q+ Q: ~+ L4 c
function IsaNull(cCheck)
; C' y+ a% i& {4 E {
4 K; P$ D& J4 Q return(cCheck != " ")
. \5 U$ Q7 x3 c$ [; Z }
- h" d" G4 J7 _ W \3 m$ U% \' w. b; u7 N ' u3 w+ s# q+ m3 H" u" I
function checkform() 4 m5 m0 n& {+ h/ c% m+ G' a: |
{
, t' L3 S5 J7 X6 k0 d id = document.sform1.id.value;
$ @. m5 C, {: [ if (id == "")
% ~* o* ]# h: b: |/ k& O1 |9 \9 T {
0 X n2 \$ U6 z9 @ alert("请输入注册名"); - L1 |# {# C( Y, P' L
document.sform1.id.focus();
' S& u( G) }: t: z+ Y return false;
9 a4 p( X6 B* b }
1 ~1 |. b% E; V+ G
5 q- q% d3 Z4 i" @ for (nIndex=0; nIndex<id.length; nIndex++)
" v. V5 v, b+ t5 [- `& T { ; p4 n. x1 L" c9 c, }
cCheck = id.charAt(nIndex); ; F' g- Z4 Y. B- X4 \2 }
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) 3 m: R7 Y! I3 D) _9 ^" ^
{ y% J" ]. o- q* I
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
+ j) T4 K' l! D7 c, G document.sform1.id.focus();
2 G# _1 R# Z- |) p8 L return false;
! [; C4 `/ Y0 K2 m- A) n3 ^* y } , Y9 X. M4 x6 g) l) X
}
) h! L( `( E6 s; G9 q chineseid = document.sform1.chineseid.value;
1 E4 C2 ]9 W Z0 h* n- i: k8 M2 | if (chineseid == "") . z' P) _% } \& h: Z5 X$ r% m
{
4 m# q5 z2 a. [4 e* S2 m9 t4 g alert("请输入中文昵称"); # {5 i+ Y$ S# I3 L$ s* |/ `
document.sform1.chineseid.focus(); / K+ Y3 O( c: ?
return false;
$ B8 b# _& E# @/ z0 \9 P$ S7 h } $ M& k) @. K. Y, A. L) u
password = document.sform1.password.value;
4 c5 }+ k0 f( X$ O if (password == "")
# u/ y8 [9 _ A1 \1 x$ o& G { 3 V6 ~( ?2 x3 G. }
alert("请输入登陆密码"); 9 o h! X( \( d) K
document.sform1.password.focus(); % u9 |) R* Q, V! h: G
return false; 5 B) H8 D& P# r- f" o. f0 a1 ]/ `
} 0 e8 v; M# ^- x- Y+ l
password1 = document.sform1.password1.value; ! O# B( y+ C1 A) c0 \8 S0 z
if (password>password1) . p) B9 c& T: N2 g' r* H
{
! [0 s! V% t, Y- | alert("重复密码与登陆密码不相同"); $ w2 x& D' q, u. W7 h" \0 t
document.sform1.password.focus(); 0 v8 Y2 l6 Q& G$ l! e- f' ^
document.sform1.password1.focus();
6 |$ J; E# R. W5 \/ d# i return false;1 a7 G1 e+ S1 G$ W& S
}
( G* i- _9 J1 A4 wif (password<password1)
0 H- j4 e6 ?; Q9 o1 _- c- ^/ X {/ m) B( U/ B- C
alert("重复密码与登陆密码不相同");
- `: d9 y! ]" [9 J; i/ D l document.sform1.password.focus();
' t }) J. L: ]9 y. [8 s document.sform1.password1.focus(); 0 H6 z( t6 c/ H& \6 d0 K6 B
return false;4 f+ o1 ^" A0 W1 s* }- B
}
: I8 `% t( L3 i L if (document.sform1.email.value == "")
* N3 F" _0 k6 H1 ]8 a( `' G { 7 s+ S3 c# z, _; r2 @
alert("请输入您的E-MAIL地址"); 2 t( E/ \/ j+ j* s7 x8 \/ F
document.sform1.email.focus();
1 t! K" Y% c7 l9 T' \. c; I return false; / Q0 u; @9 p% Q z
}
2 r; Z6 n. i9 J
6 g8 o1 c; l8 H1 w$ o email=document.sform1.email.value;
$ h3 ^0 T" G' U6 g2 N! z1 r5 [7 l emailerr=0
& f- J# E, o0 i S6 g for (i=0; i<email.length; i++)
; J! V2 c8 @5 o) u {
* J5 Z& H2 q! P" H7 f if ((email.charAt(i) == "@") & (email.length > 5))
6 B6 m7 Z! M4 x, F, E {
4 h s6 P6 V2 x) [2 H6 g emailerr=emailerr+1
4 q3 ]) ~1 U4 E. J R }
* L( _/ ?' G+ W0 d9 n+ @! l1 ^2 A }
- G) h. s: E! ?( f: k if (emailerr != 1) 4 m: t9 I5 z9 |0 H( j2 h
{ . A3 q+ i( g0 E; N* w+ u- q/ x' d
alert("请输入正确的E-MAIL地址");
* `/ {9 I7 m8 y) _) r+ B# B. X& K document.sform1.email.focus(); 7 ?: g( U4 d4 ~' Y
return false; 5 ]* H& W6 i P+ j. y( b j
}
q" X4 e6 H+ a* ^! R$ {" z$ w7 R
& h+ K/ e. c- J/ W3 ? if (document.sform1.checkask.value=="")
& \6 @6 s8 t* a1 m {
$ i' d5 J0 f4 r alert("密码提示问题不能为空"); / B8 b; W: S' P5 i
document.sform1.checkask.focus();
/ [- Z `; P9 x( I8 F return false; ! B: _) I' n U- g
}
5 D) Z$ n! Q- X4 D; R if (document.sform1.checkans.value=="") " Z2 \" s1 b* j6 ]" c
{
- m" }* t3 h5 `* z alert("您的密码提示问题答案不能为空");
0 y+ l+ u, k5 u1 Q2 Y8 A document.sform1.checkans.focus(); - I( K0 P& W2 n; l- A. [6 r
return false;
* X; z# ]1 A" p }
8 r" m" t1 x6 H- b7 f5 o2 ~ return true;
, A4 i2 l Z( m2 g" I# Y
6 H3 P; I; P# s0 H* g} ' e x! r8 w# D$ G- W$ V
</script> |
|