|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14423
- 金币
- 2497
- 威望
- 1647
- 贡献
- 1445
|
这个脚本对你可能有帮助:
) S: e" L6 N' @& F$ i, J<script language="javascript"> & c4 d; a+ D: L) x3 w, j# c" I
function IsDigit(cCheck) . i6 o% E Z! c O8 X# H# ?$ r
{ ' C7 Y; ?0 D0 [# A
return (('0'<=cCheck) && (cCheck<='9')); 1 }4 P# c6 }1 ~
}
+ E8 h/ N" O, Z* d5 D) J
1 P* U; [, Z- i0 I" z9 J( ifunction IsAlpha(cCheck) ! j5 l1 \+ ^+ }# R
{ 0 c5 b; W3 f- I' x
return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
9 Q* U9 i+ H) V2 W } 3 u4 ~( \9 I$ L
9 Q5 K* B% f( J3 F7 [
function IsaNull(cCheck)
* f; F5 w, [- `& }: B { / Z& Y+ |; ~4 G% F
return(cCheck != " ") 0 f4 o5 S" E" I4 K0 c( e
} 0 d W$ B j n5 `; M4 V' w
/ m6 Y E) i W$ j8 @1 \4 R0 t2 I
function checkform() * O B- f T8 h, J( Z: f' n
{
+ U& ~, Y' b' m1 }4 i+ @& a; ^* s9 s id = document.sform1.id.value;
0 ]4 Q$ [1 I9 X# S$ t if (id == "")
) T* P7 }9 O2 |- a" ^5 B {
/ l E" u' K) ~" A9 d x alert("请输入注册名"); $ g7 m% T4 A* o! S
document.sform1.id.focus(); ) X" M: X2 G3 v
return false;
( K" }) j, w* T5 [/ u0 `% x" w( i, N } 2 y) r6 ^) F% _1 f# w- n8 t: i
) b) H/ J8 P5 i4 V% [4 x. s
for (nIndex=0; nIndex<id.length; nIndex++) ' [, w0 B+ e4 X0 A& x+ i/ c
{ + N; T0 v5 M+ s3 X$ k' B
cCheck = id.charAt(nIndex); 8 ^' f6 s' C: C, O; w
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.')) & X* T: k/ A. p; A" a
{ 9 T0 K% ~0 f% [) }3 r
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文");
9 R0 y3 @( F O, t% R% ? document.sform1.id.focus(); ' R1 H! B4 S1 s( i
return false; # v' G V* C" K, i# n+ p
} S8 o# B. z4 u8 G
}
( [2 k* a- o; J' V. z/ m t' S chineseid = document.sform1.chineseid.value;
, c( e' O# r* d2 j, g& R if (chineseid == "") 6 |0 ~7 k) V+ b+ d z" L' N
{ & O& z& j# \" `1 i) t
alert("请输入中文昵称");
4 p% x% T) J0 B, l/ |( y document.sform1.chineseid.focus();
7 Q1 I( D5 {% z* F return false; ) U0 O O' V$ G q t
} + Y, i+ @- T; @
password = document.sform1.password.value;
2 `2 l% v. S( F! V2 Q if (password == "") 9 o- }8 v) e3 B
{
1 P; J( d& U$ W* u' N alert("请输入登陆密码"); ! r! B: g! I' T5 t5 B9 ]
document.sform1.password.focus(); , J y' q0 T- i S: e' i: j7 Z
return false; * Y2 u+ ]" l6 D' l3 F; o5 {
} - Q. H y; X5 f1 K x
password1 = document.sform1.password1.value;
" \% _+ W7 n9 b9 C: F. ^. I if (password>password1)
3 ?, P2 o7 p- u h, ? {
2 z. K2 a1 t$ H) V/ O, ^. f3 h alert("重复密码与登陆密码不相同"); 8 f- g0 C" g7 @2 p5 Z! N
document.sform1.password.focus();
- a: v: B. n& s' E5 L E. ` document.sform1.password1.focus();
! f7 ]# y J$ ~" F( @ return false;4 ~; u9 W$ D8 \" p' I
}
2 l' u1 ]" ~: u8 F* V, Uif (password<password1)
4 K3 O/ T4 L! p2 q {
M+ \! n3 m% c alert("重复密码与登陆密码不相同");
2 {" c, r# e. ^% S document.sform1.password.focus();
+ z$ x, q1 D5 ]( H3 A' H, y$ u document.sform1.password1.focus();
& V/ h, g1 K" D, ~: N+ V% w return false;9 Z6 N E9 c( v
} , v. Q% x3 X, e( i% i6 N6 I
if (document.sform1.email.value == "") 5 e! N9 M. Y2 t
{
/ A( a4 z! A8 j alert("请输入您的E-MAIL地址"); 2 u0 L& d; u% E% W
document.sform1.email.focus();
9 W6 G' o+ ~2 e* K return false; + m& T }! }1 O" f8 u& l( Z* C
} 7 r" ?/ Q% z+ f" Q) ?
# h& `% W4 U B6 o email=document.sform1.email.value; + q" q( }7 j& `; B
emailerr=0
: Y) `( d" z' \ for (i=0; i<email.length; i++) 1 q6 y/ Z, S" R% O- q; x
{ # x; Y! o% z8 a' X
if ((email.charAt(i) == "@") & (email.length > 5)) 5 O; h" y% t: m( J* w
{
" m/ V: I$ _1 O @ emailerr=emailerr+1 * B/ }/ d3 N- a1 \0 E
} + @/ E# U( L% }/ K! Q/ s/ Y
}
& w$ {# }/ k( \( s% `* k% `5 V if (emailerr != 1)
! i/ g6 I9 s. g$ f3 x$ J9 ~& ~ {
3 d" e4 l6 b* f& t' Z! h6 U* X h alert("请输入正确的E-MAIL地址");
- y4 L X1 E3 N: A+ k ` document.sform1.email.focus(); , @" J5 f" f7 R7 ~
return false; # `5 c" ^; r' h T8 x x
} / w+ s8 N. Q, ?) Z" u$ U. }
2 ^- W9 B. {! x, x
if (document.sform1.checkask.value=="")
8 O, G4 V5 g j% C: R5 | { 1 g& E! X) t4 f! B% B+ v
alert("密码提示问题不能为空");
( U& s. q/ Z) K& H' E document.sform1.checkask.focus();
5 F4 [: {9 u- D6 C1 ] return false;
$ O9 q& x1 i" ?$ }- w4 R }
6 {& d; S. Z- } c+ P0 _/ s if (document.sform1.checkans.value=="")
. \ v% y# _$ r, Q# a% }( M' m { 8 O d% K9 h% D! K/ R9 P4 ^
alert("您的密码提示问题答案不能为空"); : L8 V5 B* M/ Y6 N9 u5 Q, V5 P
document.sform1.checkans.focus();
, N; Z. ^& |3 F- E6 z return false; , Y2 f I0 x- [) N. v6 |& D3 {! ^
}
. I7 c: h. F$ B% N% D$ } return true; 1 f$ O- R! {; x" u; r& t) u$ n" \8 `+ S
' K8 ? S1 K. u+ F; n4 G} 2 t9 V/ y5 c2 {) p- `2 C0 a7 K5 b
</script> |
|