|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14429
- 金币
- 2500
- 威望
- 1647
- 贡献
- 1448
|
这个脚本对你可能有帮助: O* }1 A$ F% {! I
<script language="javascript"> . o7 M9 R; ` [, J" b5 f# ]% `$ v
function IsDigit(cCheck)
' i8 Z ]; d& n. w# y( }2 w {
; ?8 U' R( M5 a return (('0'<=cCheck) && (cCheck<='9'));
( M9 S! {+ E3 k' O; r } 4 E7 y, a* ?/ S3 L
4 M6 A! ^# z7 t+ G* ~& z/ ufunction IsAlpha(cCheck)
( r+ m; O; @% k4 n, ` {
8 d0 I1 ~- E7 \+ b( {) v; g( }4 L2 c return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
* e" |3 x! B# R- Z% O0 q }
: R, q3 e G. ~, g5 @
% R, d! m" @5 i! S- Y- l5 efunction IsaNull(cCheck)
7 N2 J4 L1 r0 ]: l {
8 B. G8 j- g; Z" j: J return(cCheck != " ")
S) z4 ~+ @5 }" a; O& v6 n& h }
+ P7 L- s4 v' h9 I u
]& o4 w. D% y0 lfunction checkform()
3 a& X# E F7 D; i- ]+ @{ 8 L2 L: \. D- K3 c4 r/ @/ E- M
id = document.sform1.id.value;
% B( h' Z; |% E! m) Y if (id == "") , J5 n0 W- [3 T' T) U
{
- l# e8 `. f* g8 X, W alert("请输入注册名");
5 w2 Q& Q7 X8 D document.sform1.id.focus();
) v6 s x; y& D' e! c8 } return false;
, Y/ b5 T }8 E' C }
; l' A- L) r: x6 e ( l; b+ U7 R* N3 G
for (nIndex=0; nIndex<id.length; nIndex++)
3 o) C" x, E! S1 @! }2 o {
3 K/ @- w0 N* D! R5 x I5 o4 G cCheck = id.charAt(nIndex);
* L" ^, J2 b! M8 P2 X( } if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
" u: ~ a, ^; K8 S0 j' B8 P" A1 K { 1 R g6 b0 K- I* ?; c
alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); 7 P3 C( _6 ^% f$ G4 ^1 v9 R* k0 p; B
document.sform1.id.focus(); 6 J7 \5 L) z* _6 ]2 D- S& u, ]' | g3 c4 Q
return false;
, [. C6 l2 f/ Z4 V }
6 k4 |7 W, s: E& F! ]& K& I }
# s/ \6 L6 T8 h' \0 t chineseid = document.sform1.chineseid.value;
" r" V3 r* K0 R6 I6 \ V) A if (chineseid == "") `! z' Y( A$ @9 x4 k
{
: x) d# j5 e y: p7 R alert("请输入中文昵称"); / F% T7 y+ e+ X6 o
document.sform1.chineseid.focus(); I" ~9 l& Q; k1 z& G* u
return false; f8 u8 N9 S# g/ m& \$ g% j$ ?9 H$ z g
} % |& P+ A- r* _+ E; m
password = document.sform1.password.value; / [! X7 G* q+ Z8 A. x6 T( E8 F
if (password == "") % U* S) S: a4 K/ V9 O. D
{ ) t) {1 D7 s8 m9 E- z5 `- C
alert("请输入登陆密码"); % _+ ~+ W& v) A3 l7 d4 ]) J" F
document.sform1.password.focus(); : \4 j8 }/ }' g! @
return false;
$ x' c8 H' }1 Y0 ?1 S }
: a( k/ K6 z- Z; Z3 f1 e password1 = document.sform1.password1.value;
# b" H) f6 l9 r2 T a; `% r4 | if (password>password1)
! r. `, S8 p% k0 ]( c9 j! Y. a! [ {
8 ?( y, ~! {1 U8 g9 c alert("重复密码与登陆密码不相同");
& k3 s! Z& Q9 ]' { document.sform1.password.focus();
5 E4 L, T4 B' w) z, w+ p' _ document.sform1.password1.focus();
; T- K6 @1 _: q( B; Y return false;
' O! ~6 D& ?* b9 l$ }7 ` }
9 T0 g9 A& B$ E0 k; _if (password<password1)
3 r9 b. v% l" d% s" M( H {7 ^/ [2 O5 O0 s' O
alert("重复密码与登陆密码不相同"); ; S( r8 C0 D5 Z2 Y( r- A
document.sform1.password.focus();
+ z- x( ?( c# g* I* Z9 G document.sform1.password1.focus();
" h% R- ]; z% c0 i9 ], w return false;
4 K' ~9 }+ `0 h' r7 ~0 _ } + p% Z: L3 K2 M, r5 F! v- x
if (document.sform1.email.value == "")
- Y. U' b+ _: u) _, a& L' m {
g4 x, d- a0 R9 `/ r8 w alert("请输入您的E-MAIL地址"); 1 I* }/ K7 o/ R$ a
document.sform1.email.focus(); 0 e2 ?* t- A+ w! e% A% i; B0 Y
return false; ( e5 E0 z: m4 X4 p3 V {" K$ h0 k
} ' j. w$ [( O* s+ R4 b8 w
8 E1 p" c4 V5 S g' k: l+ K email=document.sform1.email.value;
# a! W& r; |& G emailerr=0
9 j! c" Q5 @1 d! f for (i=0; i<email.length; i++) " M2 ^7 B, b& S4 ^
{
H4 t4 _3 I% B: c3 b$ r if ((email.charAt(i) == "@") & (email.length > 5))
/ x3 ^& r. S7 x0 ^ {
; y8 d4 j8 x+ n K! f emailerr=emailerr+1 ; I4 \5 Y' _& B f: v: e! l
} - Q& }: x; |( U, B$ z* T
}
. X$ J7 J, \. V% f if (emailerr != 1)
0 k% {+ r8 A7 }" m l {
& |3 u2 {, K% M+ ?# T# W alert("请输入正确的E-MAIL地址");
5 Q7 M1 @0 p( I+ V8 o" j$ T document.sform1.email.focus(); 9 `* \# b! E8 |( w7 \: |' @ g
return false; $ H8 _- X2 P- A% _6 z
} 1 `+ b5 r1 u/ Q6 P* a. p7 Y6 C* t, l. C
1 G! |6 ^1 e" x' R& @& R+ U
if (document.sform1.checkask.value=="") , m, X* A3 Z) {" G" ~7 F0 `
{
! G9 x5 J; S* D e1 D& u alert("密码提示问题不能为空");
! g1 w: q. _7 q9 z0 B2 d: w document.sform1.checkask.focus();
, G) j* Z3 S: x0 \. ? return false; 6 \6 D$ x2 W: o& {
}
& D. f( ^% ?2 }! ]. \# ^) @. h if (document.sform1.checkans.value=="") % D- s5 P C, z" z4 H5 Q. _
{
; h3 \5 F2 x5 ~. l alert("您的密码提示问题答案不能为空"); 2 p: v$ B. t% M; o
document.sform1.checkans.focus(); 6 V, Z' ?# N* Y3 E' I& t0 V1 N
return false;
2 k6 `/ I9 y' E* G. ]/ Z3 ?9 O }$ n0 c- t" H2 N x, A( M, E" K
return true; " C8 v0 [+ r4 c- l* K
6 m: i5 d1 f" i9 |0 S}
, X( W: C, f# e/ |</script> |
|