|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14431
- 金币
- 2501
- 威望
- 1647
- 贡献
- 1449
|
这个脚本对你可能有帮助:
" h6 F) U" p. x# J* ~9 Z3 n! e; j<script language="javascript">
+ l3 k+ i1 Q* K/ {function IsDigit(cCheck)
1 K$ Y$ O7 F: g {
& `6 }. d h$ k% ~) |- e return (('0'<=cCheck) && (cCheck<='9')); 1 r, t5 A0 P( o6 V" \0 U6 Z
} ' z" s" S+ W$ q, r! i
, ^, m: B- h' _function IsAlpha(cCheck)
( U+ k+ D; w5 ], P6 w0 h& h6 Y& L {
; [# } u& B+ s8 s return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) ; G: l; ^: R) ~; n* a! d% V! k# A- R
}
w6 u; z: ?& z
! }& Z+ G9 g p- C3 Y% \function IsaNull(cCheck)
, c$ |6 x+ ^4 R9 }5 I- v# [ S {
. o A6 E- u( _: d$ } return(cCheck != " ") / @4 D- k, [1 {- {8 t9 l+ D
}
. w+ {% X( P/ P# |
9 p& H k. D$ f; n: O- bfunction checkform() 7 Q! w# o! F% G7 ^: y# r
{
# i6 G! a+ x B( o% Y0 L0 B* V id = document.sform1.id.value;
- i" B/ h" r, a9 ^9 X4 { if (id == "")
k* k$ `" N2 U$ J) I2 u { ! M+ }5 g; V) `/ L: a, ~
alert("请输入注册名");
( }' N( N! ?% R, N z5 N; A document.sform1.id.focus();
& A1 ?! m3 i7 f+ S# X return false; ' P4 q% n2 ]& _! C* _
}
/ l( R9 y* n3 n
/ `( Z: g/ [$ N# y% X9 l0 o for (nIndex=0; nIndex<id.length; nIndex++) . C( C$ L M0 n2 Q
{
$ g, a, V! s( U cCheck = id.charAt(nIndex);
) _- I6 g+ Q7 t7 G) M! n7 _% L& D G if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
6 M; y* F8 J8 b) y- D+ I4 c { 6 ]& a% L- Z/ e! p" ]4 c
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
M: G' O( {8 T+ L7 D& O3 e document.sform1.id.focus(); ! ?& \+ ~- o7 _6 J" A. z
return false; ) [: Z+ s* O; |9 S) a) [
}
& {) _7 F p. g8 u/ ~1 u' i, D8 m) l }
! v" N+ o- C. a) J chineseid = document.sform1.chineseid.value; : K# Z8 N/ u& y; z2 g+ R
if (chineseid == "")
1 m+ G( }- Z; e3 ^- T { 4 W% ]/ ~5 X( B2 ]2 l8 g
alert("请输入中文昵称");
+ K0 _. _: i- P. |, T$ v document.sform1.chineseid.focus(); ) _* V- q. z; |' E
return false; 5 P( c; K; I% r( Q
} % c( x3 n7 r( g% B) h% N* t
password = document.sform1.password.value; 4 D8 ?8 ~0 R: z( o
if (password == "")
) X( _/ W! x. d. `7 | {
1 s. Q5 N6 {' ]4 K5 l alert("请输入登陆密码"); & M9 Q8 n# P z) U: H& v' g
document.sform1.password.focus();
9 I1 V7 k. @5 s0 u A5 B) e return false;
1 ]6 p+ E' A% | } + y+ z/ ^- d; j# \
password1 = document.sform1.password1.value;
4 Q' |, Y( {( H/ W' k if (password>password1)
9 O* D6 T6 B# y; }) t {
4 H% T6 \( `# s( O alert("重复密码与登陆密码不相同"); " U, a: \/ D5 q {$ t2 e1 O. [
document.sform1.password.focus();
- L9 D6 o! _4 a document.sform1.password1.focus(); 6 y `( ? f6 _0 _
return false;& I/ y1 R3 e0 G I1 V
} ' S0 @2 ~6 J) D; l8 ^$ x. w9 z
if (password<password1)
8 Z; F. X" c0 b N( V% F; j {# Y# ?1 j# p: P- d7 P
alert("重复密码与登陆密码不相同"); + u' b1 ~5 g6 S
document.sform1.password.focus(); ! J2 W' F9 s5 Y+ J2 l& g; a
document.sform1.password1.focus();
8 d6 ?( [, x0 A, ^* X' G& J+ a return false;: G6 A' K( @$ a3 f2 R
} m# w) {. _+ r+ B4 o: i9 |
if (document.sform1.email.value == "")
, U) G$ i- z* o: a3 V { + B `+ f1 h3 w' Q& r3 U. b8 n
alert("请输入您的E-MAIL地址");
( v8 F$ ?* O" O- `$ f0 V+ ~: ^ document.sform1.email.focus(); # p2 r- i8 e8 t: E/ R: v- }! e- V. K5 L
return false; % U) J0 ~1 U: n+ b+ b) N
} ' k4 ?+ _7 z" r2 r( i' ~/ H& i
! Z! `+ h6 E) A2 c, ^+ Y3 R. o
email=document.sform1.email.value;
: ?% G* f$ T- L% Z' u+ T+ C emailerr=0
; M1 i. C* N9 E8 f1 F, Z for (i=0; i<email.length; i++) 2 C3 P" E4 \9 C" ?/ i+ u5 F! w
{
y0 C) M% U9 {: ?) L if ((email.charAt(i) == "@") & (email.length > 5)) ( I1 i" B" o5 ?
{ 0 ^# o( T# L9 v" q
emailerr=emailerr+1
0 z: H( I+ f. L/ t6 D$ ^$ K } ( t d4 ~+ m! f; p7 u
}
% l8 C6 r; J) V) b& F7 p' z if (emailerr != 1)
% A/ l/ B3 x. s: p! f. _: l {
5 b% h ]3 q5 f7 D alert("请输入正确的E-MAIL地址"); : M4 S0 w: }/ P( q0 L+ Y5 l
document.sform1.email.focus();
' j- e4 d+ W% t" b return false;
# R2 ?# V" Z9 G7 E6 g } # e& m% X$ K! E. W; N
9 ^; D W4 ]; W
if (document.sform1.checkask.value=="") ( R- m1 {: q- G1 P
{ 1 s4 x7 D# n% l5 \$ N8 h& Y7 ]5 b
alert("密码提示问题不能为空");
4 R3 k" Q- U* E* F3 z! X: A5 V9 w5 f document.sform1.checkask.focus();
7 g4 S8 Q4 F) _! j8 k; i& M return false; 3 u. D! f- H" L
}
+ _9 M* |/ @9 o if (document.sform1.checkans.value=="")
, ]( S& q8 d5 j7 C {
) J, O- k+ ^0 x& ~# X: F L) P$ x alert("您的密码提示问题答案不能为空"); * `4 R$ C4 N) [7 `+ c
document.sform1.checkans.focus();
4 M4 ?! T `2 ^ return false;
, z- p) V; E' i# } }
, y2 Z* R; T) Q+ q4 y# Z1 Q return true;
! D6 ]# K3 n$ y! W: v: M
& A; `; A# {9 A" R}
3 ?, g3 O7 r. o6 D' Y</script> |
|