|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14395
- 金币
- 2483
- 威望
- 1647
- 贡献
- 1431
|
这个脚本对你可能有帮助:
0 s1 {2 o$ P3 Z# b! [8 h$ G/ c<script language="javascript"> s% Z% z P2 ~/ z# c9 Y V
function IsDigit(cCheck)
* V# k4 C% d, s" Z+ \2 x {
: R+ o k x* F; y return (('0'<=cCheck) && (cCheck<='9')); " q$ x+ d( P M
}
) W5 G2 i( T- P( j9 _
/ u4 _, w( } w- ^4 `function IsAlpha(cCheck)
( }4 @1 C3 s5 ^0 S {
) o3 H# N$ C( N5 O5 {' S- j( c return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) . ?& f& ?1 F0 W0 c8 j
} ' ]8 I) d! ]: p
: @" y7 h: Z# \. G/ P9 d1 E, z( xfunction IsaNull(cCheck) 9 b) @5 T" E# {. z# ]9 ^8 _4 L
{
" C* H6 N7 Y+ H( E: z. ?2 q. E' e0 Q return(cCheck != " ") ; { W' \, `( s0 P5 Q1 N
}
0 B# E, q# ?6 r5 S" i1 [
1 p! X2 Q+ j) o5 F( {* P+ Ifunction checkform()
7 n2 B* }8 o3 W% a" }( p{ 5 g# U. @, F5 _+ V& B0 e/ P0 M
id = document.sform1.id.value; . I" X3 {) e# `: F, S0 ?0 Z* ?$ H
if (id == "")
5 O _/ N' g* Q6 a6 d5 S' j! B6 `, b8 o {
8 @: l; E- n/ a! V( u alert("请输入注册名"); 3 x: T4 I& }% v/ ^7 A* B
document.sform1.id.focus();
. i/ [% l" x: f$ `5 i return false;
/ |( a4 a3 ~# Y$ [ } 5 n8 g1 e+ W! J8 ^5 _6 @
4 V$ z5 F c* I2 F0 ]) a! B5 O for (nIndex=0; nIndex<id.length; nIndex++) 7 }) Y$ _6 B ^0 s M. U
{ ; _8 R- o) T. z+ i: ]
cCheck = id.charAt(nIndex); $ i. M0 X; G0 K8 {; E1 `
if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
) b6 T, h& S! i: M7 | { 9 W) K! h2 L: ^
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 5 n9 \7 \/ Q8 @6 C
document.sform1.id.focus();
, G! Z9 X1 h0 r! G) x# V& U return false; ( y# L/ ^2 N" D. L% m( _7 D+ _
}
2 \( d/ b% v2 h. {' ?. q7 r2 d6 }+ X/ ? } ; N1 B, Z' I- J3 J% ^
chineseid = document.sform1.chineseid.value; 4 c# {. [. N( X
if (chineseid == "") . `6 ^2 ~) m, n) J: Q2 W* J
{ 3 c% z7 o+ I( _' d l
alert("请输入中文昵称"); 4 C4 S( q" A# O
document.sform1.chineseid.focus();
/ X* E* p9 R# ?; y6 ~/ U return false; + G" t4 w( L4 I- M) |
}
+ h' S3 X' K. c password = document.sform1.password.value;
0 Q# C" h* Q' ?/ U0 T" u% D if (password == "")
g# C1 R- ~9 `. |: v8 k0 s8 h% v3 N; P6 | {
6 `3 l. R5 c2 @* X H1 g8 Z alert("请输入登陆密码"); 8 F% @5 b/ X3 ^: s2 w8 w) l
document.sform1.password.focus();
" r7 m9 a, J% _5 p5 {) ~( E6 e, q return false; * G1 u: M+ p2 h6 ]( _2 i
} : D7 q7 d# k7 \ x% L# J; M% f- U
password1 = document.sform1.password1.value;
, P- I4 H7 m$ H1 d if (password>password1) 6 [' x5 |' m9 S4 @) A
{
, G; x4 t/ q! @* l2 z ]8 O4 @ alert("重复密码与登陆密码不相同");
1 t Q+ t: g7 D; D# Z5 s document.sform1.password.focus();
! W& n( `' b* }! V+ P, W5 u, d) T: q document.sform1.password1.focus(); % n% a# f7 f! t1 B( I: x) o
return false;
9 A3 v7 ~4 ]6 g9 D h } / Y$ P2 s, K$ [9 M
if (password<password1)
' U! Z8 G' W* x8 a# H {
) @, @8 p/ P4 k+ k& l& s" Q D alert("重复密码与登陆密码不相同");
c, O+ b: @2 Z2 o5 u9 e" ` document.sform1.password.focus(); 2 U6 Z1 V* C: G/ _8 D$ t/ v
document.sform1.password1.focus();
( l5 m& I U/ S/ v5 r return false;. r7 ~. }; n( ]7 B
} : A) b. @ l2 \" I# F' ?& y" P' J
if (document.sform1.email.value == "") " x N5 S$ ], L* z
{ # D, l; T% b9 `2 D8 y
alert("请输入您的E-MAIL地址"); ! U1 A! Z3 ~ F9 p
document.sform1.email.focus(); 5 [& p, m: X9 X! ?7 }$ U0 u
return false; ( C0 |9 |* d0 m+ Z( ], k
} , S% _: |5 J* {6 ?- d- Z% |
2 C2 @. X1 l+ \) n" s
email=document.sform1.email.value;
) M3 P3 \; C+ [2 `" y9 a emailerr=0 6 M: P3 r% M+ \& c3 i
for (i=0; i<email.length; i++) 8 t7 B% U# U* e N
{
) v9 d) t ]7 ]4 e: w% [ if ((email.charAt(i) == "@") & (email.length > 5)) 9 M* P- }5 ]" I; V \6 s+ \
{ 5 b0 M: d, m( S4 H8 x" I c
emailerr=emailerr+1
% [* @+ t2 G4 H4 S" Z) q6 k } 1 A1 Q8 ^6 j$ d g
}
) Y2 v& _, m% _$ y$ \ if (emailerr != 1) . p% u7 M* [) R
{
7 A0 r2 x+ A2 O) o8 x alert("请输入正确的E-MAIL地址"); / S$ q" _7 j# b- s$ n
document.sform1.email.focus();
4 \- k( V) L' u return false; . x" Y" i) \% z4 N- z4 T# u
}
# y+ [/ ^, S5 l' X. A' ]
1 G7 E, h/ e* Z3 w- P2 n if (document.sform1.checkask.value=="") , ^! i; n5 L# n& R
{
% g5 z0 R/ ^3 t alert("密码提示问题不能为空");
8 f' w6 A0 u6 R9 B, Z document.sform1.checkask.focus();
; v, A9 p# X2 | return false;
; x* a& k, X9 t! t }
7 o, Y2 A4 b; i( E8 @& C. F if (document.sform1.checkans.value=="") * Q; z" ?# }3 r( S1 s
{
7 m1 U( d1 o4 q4 P8 ~ alert("您的密码提示问题答案不能为空");
! i6 a; A* i8 Z$ f8 } x document.sform1.checkans.focus();
8 u' Z& ~# C* N! d2 r9 M5 V# N return false; ; x" g# e) ^& ?8 [$ W. ?
}6 ^1 }3 _! Z- I. w4 j: ^
return true;
: m4 w: v6 x$ Y Y& I0 b; R( H " T: [( n! P8 E% M
}
7 ` w' N- L- t" \</script> |
|