|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14419
- 金币
- 2495
- 威望
- 1647
- 贡献
- 1443
|
这个脚本对你可能有帮助: m) I& p: k7 L. i7 M
<script language="javascript"> 8 h# E/ |& Z8 _: ?9 _& V
function IsDigit(cCheck) / ]3 o% @- Z! A& L1 Y) Z
{ ; F9 [+ v% j, E# N. v3 R
return (('0'<=cCheck) && (cCheck<='9')); 7 v% [ X" m: }8 r
} 4 G: w" l `0 S- F8 U# O
$ C) N; K S: \, v0 D, g' ]5 f* F
function IsAlpha(cCheck)
) l: k1 {* }8 t# C( G' ~ {
( v" G" u( x1 F; j return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) % |8 W) j8 D( j2 j1 `* U, a
}
" m3 e8 S. r1 @ 4 K! m) }5 A, o7 l6 I
function IsaNull(cCheck) : U8 l& j* Q, i# r" J( S( w+ Y
{
h7 r. c: W2 r return(cCheck != " ")
. ?& `. {6 w$ |' T3 e0 f }
( G% w6 a) x1 }; I/ j
) X. f: W- Y( G7 {' X: |! P0 s8 ~function checkform()
8 o$ t n/ }- v, a3 ~6 q1 W3 R{
|; R/ a$ Y% S" Y; u id = document.sform1.id.value; 3 p' R$ o I) Y* v2 x% v
if (id == "") . E, L6 S. O: a0 U* O+ f- x. ~1 H
{
& S- {2 J0 K0 \9 Q alert("请输入注册名");
3 ]+ k0 V2 \4 O: g document.sform1.id.focus();
& D2 M" _( M* D return false;
3 G2 o0 s9 v! w6 x }
4 r7 `0 |; q+ a! G
! ~& v/ R# z# p$ `! C, l" r for (nIndex=0; nIndex<id.length; nIndex++) , M/ Q" `+ ]6 w3 L+ \) B$ w- z$ U
{ ~" _- k+ a7 d! Q
cCheck = id.charAt(nIndex);
- v# l8 e- D" Z8 C' e if (!(IsDigit(cCheck) || IsAlpha(cCheck) || cCheck=='-' || cCheck=='_' || cCheck=='.'))
% s3 T, F0 \/ i- C {
1 d, C9 N) E e* r+ M+ T' J1 K alert("用户名只能使用字母、数字以及-、_和.,并且不能使用中文"); % n- o, t& M6 A+ H- m" u
document.sform1.id.focus();
6 ^5 g/ R: L4 r9 Q* H! I2 R) i5 { return false;
" _6 W; B# t( ^0 H4 ?- ?$ x } 7 ?5 U( L1 U$ P5 m
}
5 k7 j( U" Y8 h( w' R3 k; W" @7 J chineseid = document.sform1.chineseid.value; , E6 l" q# _! R. A8 z* l
if (chineseid == "")
- d7 G" w8 k- K/ X( S7 z {
+ O7 [' d, e1 q/ i7 v9 j2 h" j- i alert("请输入中文昵称");
& d" g! i9 j+ w; V document.sform1.chineseid.focus(); 9 {+ l6 ?9 D% N& G% w/ C8 s, E9 E# x
return false; 7 Q& ?' O' m6 E, E/ B
} 4 Z: `4 M% Q" { o
password = document.sform1.password.value; & S w; T0 @$ i7 |
if (password == "") + {0 n) c1 \, r/ q3 L
{
9 B6 M. g- l* i! j alert("请输入登陆密码"); " A# z# u; }$ `. S) K0 ?0 ^
document.sform1.password.focus();
. j+ p Z0 X. `4 p! I N! M return false; 3 a3 x, }. |2 j( w& t/ f/ y
}
1 m- e9 {& T9 `5 h/ Z password1 = document.sform1.password1.value;
# ^$ P1 W* o ~5 |6 e9 l' L* ] if (password>password1) : t4 m+ w# Q8 }- z
{
4 X+ l4 |' S0 n6 J alert("重复密码与登陆密码不相同"); + Z8 e& u5 G+ M* G9 y$ X1 D! U! B( \
document.sform1.password.focus();
6 D+ O6 d! k6 y) R$ e. \9 T3 V document.sform1.password1.focus();
: s3 G: L; ], ? return false;/ F) w9 k4 q+ h# i# J( F
}
! @- s3 K" M, \0 i3 R4 Cif (password<password1) " F0 p' P* E/ z3 i
{" y1 I, P& l4 @6 G& |) f
alert("重复密码与登陆密码不相同"); % s$ _1 s) [1 h% f: Z! E, V+ Y3 ]
document.sform1.password.focus(); 3 o$ ~5 G0 t! f+ C; K
document.sform1.password1.focus();
' x; v) e# Q6 W5 P: r5 ]' ]1 v return false;# F j" | ~. L7 t! E4 s4 s
} - Z8 \9 Q1 b0 H7 d, J1 j/ k$ y
if (document.sform1.email.value == "") ! n& C; d# t4 Q+ X% M
{
- P% Q1 U. y7 @: O+ X alert("请输入您的E-MAIL地址"); $ W, q0 ?' X2 v6 u/ f
document.sform1.email.focus();
" |( U' o4 j# |- Y: a! K' L6 V5 i return false; 6 c) _2 c+ z2 ^, n1 A
} 2 v) l/ i3 G) C1 c5 [
; _) m5 d# {8 Z8 W1 n email=document.sform1.email.value;
7 y, T% }' V2 J2 S- D, j# \' { emailerr=0
2 I- B2 N& g, x' B& G6 F for (i=0; i<email.length; i++)
6 L M& j+ n& W( R9 y9 q: q/ Y {
( ^. M& D2 h; m7 w7 p% C+ y- x# X if ((email.charAt(i) == "@") & (email.length > 5)) ) r% g6 w* Q$ g! b) K$ L
{
2 Z" Y4 ^( z& n9 h' x0 K8 w emailerr=emailerr+1
$ g. Q7 [' o9 G3 p' }9 N& N* h }
9 |7 g; r5 b. S } ! k s; r! r; a9 F" i4 G
if (emailerr != 1) 9 _2 z8 d2 W: R3 @5 N' E. ~
{ 9 S5 s$ M$ R+ n; G/ k6 q7 l
alert("请输入正确的E-MAIL地址");
- t$ G. ~3 v4 Y) w: e6 M- i4 y- | document.sform1.email.focus(); " u; [$ @0 s3 x9 Q0 G# T- D- ]
return false;
" X; H. O# p& D; y! ]1 C7 ` } ! R2 ?5 U' M5 c2 l( H, H
; ^1 F1 V; g9 F7 S" p [
if (document.sform1.checkask.value=="") * i3 J2 z5 j/ A- {. N
{
( B4 _! F, w+ \0 T5 Y j alert("密码提示问题不能为空");
; P% P3 N+ s9 }' E2 `3 [8 z document.sform1.checkask.focus();
7 W$ _9 s" `2 i3 J/ J1 C+ M return false;
# j; f8 k# I% ?6 c } & c& O, M# K s3 b+ {$ y, W
if (document.sform1.checkans.value=="") * ?: U, a q4 E, T1 c1 s% ?6 t
{
. R) c' c2 p( B: v alert("您的密码提示问题答案不能为空"); @3 W- A' ^. A
document.sform1.checkans.focus(); ! l; m7 a# L8 ?1 ]0 E: Q
return false;
8 D) B9 a! `# a }; p5 U& x( t* b, d$ f* P6 \
return true;
8 d/ B0 a X8 C( e2 ?2 ~+ v . I7 \; E q0 p3 t
}
. }$ Q# J L) ^</script> |
|